|
| 1 | +name: Prepare Release Apps |
| 2 | + |
| 3 | +permissions: {} |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + schedule: |
| 8 | + # Triggers every Monday at 5pm Shanghai time (9am UTC) |
| 9 | + # See prepare job condition - only runs on even week numbers |
| 10 | + - cron: "0 9 * * 1" |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + prepare: |
| 18 | + name: Prepare Release |
| 19 | + runs-on: ubuntu-latest |
| 20 | + # Run on manual trigger OR on even week numbers only |
| 21 | + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && (toNumber(strftime('%U', utcNow())) % 2 == 0)) |
| 22 | + outputs: |
| 23 | + pull-request-number: ${{ steps.pr.outputs.pull-request-number }} |
| 24 | + oxlint_version: ${{ steps.run.outputs.OXLINT_VERSION }} |
| 25 | + oxfmt_version: ${{ steps.run.outputs.OXFMT_VERSION }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + persist-credentials: false |
| 31 | + |
| 32 | + - uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8 |
| 33 | + with: |
| 34 | + cache-key: warm |
| 35 | + tools: cargo-release-oxc |
| 36 | + |
| 37 | + - name: Generate version and changelog |
| 38 | + id: run |
| 39 | + run: | |
| 40 | + cargo release-oxc update --release oxlint --release oxfmt |
| 41 | + echo "OXLINT_VERSION=$(cat ./target/OXLINT_VERSION)" >> $GITHUB_OUTPUT |
| 42 | + echo "OXFMT_VERSION=$(cat ./target/OXFMT_VERSION)" >> $GITHUB_OUTPUT |
| 43 | + { |
| 44 | + echo "# Oxlint" |
| 45 | + cat ./target/OXLINT_CHANGELOG |
| 46 | + echo "" |
| 47 | + echo "# Oxfmt" |
| 48 | + cat ./target/OXFMT_CHANGELOG |
| 49 | + } > ./target/PR_BODY.md |
| 50 | +
|
| 51 | + - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 |
| 52 | + |
| 53 | + - name: Rebuild NAPI bindings |
| 54 | + run: | |
| 55 | + pnpm --filter oxlint run build-dev |
| 56 | + pnpm --filter oxfmt run build-dev |
| 57 | +
|
| 58 | + - name: Update Cargo.lock |
| 59 | + run: cargo check |
| 60 | + |
| 61 | + - uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 62 | + id: pr |
| 63 | + with: |
| 64 | + # bot account with PAT required for triggering workflow runs |
| 65 | + # See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs |
| 66 | + token: ${{ secrets.OXC_BOT_PAT }} |
| 67 | + commit-message: "release(apps): oxlint v${{ steps.run.outputs.OXLINT_VERSION }} && oxfmt v${{ steps.run.outputs.OXFMT_VERSION }}" |
| 68 | + title: "release(apps): oxlint v${{ steps.run.outputs.OXLINT_VERSION }} && oxfmt v${{ steps.run.outputs.OXFMT_VERSION }}" |
| 69 | + branch: release/apps |
| 70 | + branch-suffix: timestamp |
| 71 | + base: main |
| 72 | + body-path: ./target/PR_BODY.md |
| 73 | + assignees: Boshen |
| 74 | + |
| 75 | + ecosystem-ci: |
| 76 | + needs: prepare |
| 77 | + name: Trigger Ecosystem CI |
| 78 | + runs-on: ubuntu-latest |
| 79 | + permissions: |
| 80 | + pull-requests: write |
| 81 | + contents: write |
| 82 | + steps: |
| 83 | + - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 |
| 84 | + |
| 85 | + - uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 |
| 86 | + id: comment |
| 87 | + with: |
| 88 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + issue-number: ${{ needs.prepare.outputs.pull-request-number }} |
| 90 | + body: Triggering Ecosystem CI https://github.com/oxc-project/oxlint-ecosystem-ci/actions/workflows/ci.yml |
| 91 | + |
| 92 | + - uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 |
| 93 | + with: |
| 94 | + repo: oxc-project/oxlint-ecosystem-ci |
| 95 | + workflow: ci.yml |
| 96 | + token: ${{ secrets.OXC_BOT_PAT }} |
| 97 | + ref: main |
| 98 | + inputs: '{ "issue-number": "${{ needs.prepare.outputs.pull-request-number }}", "comment-id": "${{ steps.comment.outputs.comment-id }}" }' |
| 99 | + |
| 100 | + website: |
| 101 | + needs: prepare |
| 102 | + name: Update oxc.rs |
| 103 | + runs-on: ubuntu-latest |
| 104 | + permissions: |
| 105 | + actions: write |
| 106 | + steps: |
| 107 | + - uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1 |
| 108 | + - uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 |
| 109 | + with: |
| 110 | + repo: oxc-project/oxc-project.github.io |
| 111 | + workflow: release.yml |
| 112 | + token: ${{ secrets.OXC_BOT_PAT }} |
| 113 | + ref: main |
| 114 | + inputs: '{ "issue-number": "${{ needs.prepare.outputs.pull-request-number }}", "version": "${{ needs.prepare.outputs.oxlint_version }}" }' |
0 commit comments