Prepare Release Crates #195
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: Prepare Release Crates | |
| permissions: {} | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Triggers every Monday at 5pm Shanghai time (9am UTC) | |
| - cron: "0 9 * * 1" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8 | |
| with: | |
| cache-key: warm | |
| tools: cargo-release-oxc | |
| - run: cargo ck | |
| - run: cargo release-oxc publish --release crates --dry-run | |
| prepare: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| pull-request-number: ${{ steps.pr.outputs.pull-request-number }} | |
| version: ${{ steps.run.outputs.CRATES_VERSION }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8 | |
| with: | |
| cache-key: warm | |
| tools: cargo-release-oxc | |
| - name: Run | |
| id: run | |
| run: | | |
| cargo ck | |
| cargo release-oxc update --release crates | |
| echo "CRATES_VERSION=$(cat ./target/CRATES_VERSION)" >> $GITHUB_OUTPUT | |
| { | |
| echo 'CHANGELOG<<EOF' | |
| cat ./target/CRATES_CHANGELOG | |
| echo EOF | |
| } >> $GITHUB_OUTPUT | |
| - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
| # Run NAPI-RS build, because NAPI-RS uses version from `package.json` in the bindings file, | |
| # which is committed to the repo. The version has just been bumped in previous step. | |
| # We don't use the compiled `.node` binary, so only do a development build, as it's faster. | |
| - name: Rebuild NAPI packages bindings | |
| run: | | |
| pnpm --filter oxc-minify run build-dev | |
| pnpm --filter oxc-parser run build-dev | |
| pnpm --filter oxc-transform run build-dev | |
| - name: Update Cargo.lock | |
| run: cargo check | |
| - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| id: pr | |
| with: | |
| # bot account with PAT required for triggering workflow runs | |
| # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs | |
| token: ${{ secrets.OXC_BOT_PAT }} | |
| commit-message: "release(crates): oxc v${{ steps.run.outputs.CRATES_VERSION }}" | |
| title: "release(crates): oxc v${{ steps.run.outputs.CRATES_VERSION }}" | |
| branch: release/crates | |
| branch-suffix: timestamp | |
| base: main | |
| body: ${{ steps.run.outputs.CHANGELOG }} | |
| assignees: Boshen | |
| ecosystem-ci: | |
| needs: prepare | |
| name: Trigger Monitor Oxc | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 | |
| - uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 | |
| id: comment | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ needs.prepare.outputs.pull-request-number }} | |
| body: Triggering Monitor Oxc https://github.com/oxc-project/monitor-oxc/actions/workflows/ci.yml | |
| - uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 | |
| with: | |
| repo: oxc-project/monitor-oxc | |
| workflow: ci.yml | |
| token: ${{ secrets.OXC_BOT_PAT }} | |
| ref: main | |
| inputs: '{ "issue-number": "${{ needs.prepare.outputs.pull-request-number }}", "comment-id": "${{ steps.comment.outputs.comment-id }}" }' |