Publish Latex-Pretext Package #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Latex-Pretext Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| level: | |
| description: "Release level" | |
| required: true | |
| type: choice | |
| default: "patch" | |
| options: | |
| - "patch" | |
| - "minor" | |
| - "major" | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Update unified-latex to latest release branch commits | |
| run: npm update @unified-latex/unified-latex-to-pretext @unified-latex/unified-latex-util-parse @unified-latex/unified-latex-types | |
| - name: Bump Version | |
| run: | | |
| cd packages/latex-pretext | |
| npm version ${{ inputs.level }} --no-git-tag-version | |
| cd ../.. | |
| - name: Get Version | |
| id: version | |
| run: echo "VERSION=$(jq -r '.version' packages/latex-pretext/package.json)" >> $GITHUB_OUTPUT | |
| - name: Build Package | |
| run: npm exec nx build @pretextbook/latex-pretext | |
| - name: Publish to npm | |
| run: | | |
| cd dist/packages/latex-pretext | |
| npm publish --provenance | |
| - name: Commit and Push | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| git add packages/latex-pretext/package.json package-lock.json | |
| git commit -m "chore(latex-pretext): bump to v${{ steps.version.outputs.VERSION }}" | |
| git push origin main | |
| - name: Create Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "latex-pretext-v${{ steps.version.outputs.VERSION }}" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="Latex-Pretext Package v${{ steps.version.outputs.VERSION }}" |