Skip to content

Action to push to the MathJax repository #1275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
NAME : Publish Release to MathJax

on:
release:
types: [published]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout MathJax-src repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
run_install: false

- name: Install dependencies
run: pnpm -s i

- name: Build MathJax
run: |
./components/bin/version
pnpm -s link:src
pnpm -s build

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will have been done as part of publishing the npm package, I'm wondering if we can't just install the npm package rather than rebuild everything again. That way, we are sure the two packages are actually the same.

# - name: Get files to push from package.json
# id: get_files
# run: |
# # Extract the "files" list from package.json
# FILES=$(jq -r '.files | join(" ")' package.json)
# echo "FILES=$FILES" >> $GITHUB_ENV

- name: Create MathJax branch and push build
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"

# Get the release name from the context
RELEASE_NAME="${{ github.event.release.name }}"

# Clone the MathJax repo
git clone https://github.com/MathJax/MathJax.git
cd MathJax

# Create a new branch using the release name
git checkout -b "$RELEASE_NAME"

# Copy the build output from MathJax-src repo to MathJax
cp -r ../bundle/* ./
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to remove the old files first, in case any were deleted or renamed. For example, we are not having the -full files any more and if we don't delete them, they will remain in the package.

You might look a the 4.0.0-beta.7 package.json file's scripts to see what is currently done.


# Add, commit, and push the changes
git add .
git commit -m "Add build artifacts for release $RELEASE_NAME"
git push origin "$RELEASE_NAME"

- name: Create a pull request in MathJax
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: MathJax/MathJax
head: "$RELEASE_NAME"
base: develop
title: "New build artifacts for release $RELEASE_NAME"
body: "This pull request contains the build artifacts from release $RELEASE_NAME."