Skip to content

Commit 6967421

Browse files
committed
ci(release): single oxlint and oxfmt release pipeline
1 parent dac2a9c commit 6967421

File tree

9 files changed

+406
-473
lines changed

9 files changed

+406
-473
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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 }}" }'

.github/workflows/prepare_release_crates.yml

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ permissions: {}
44

55
on:
66
workflow_dispatch:
7+
schedule:
8+
# Triggers every Monday at 5pm Shanghai time (9am UTC)
9+
# See check job condition - only runs on even week numbers
10+
- cron: "0 9 * * 1"
711

812
concurrency:
913
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
@@ -13,6 +17,8 @@ jobs:
1317
check:
1418
name: Check
1519
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))
1622
steps:
1723
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
1824
- uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8
@@ -23,13 +29,61 @@ jobs:
2329
- run: cargo release-oxc publish --release crates --dry-run
2430

2531
prepare:
26-
needs: check
27-
name: Prepare Release Crates
28-
uses: ./.github/workflows/reusable_prepare_release.yml
29-
with:
30-
name: crates
31-
secrets:
32-
OXC_BOT_PAT: ${{ secrets.OXC_BOT_PAT }}
32+
name: Prepare Release
33+
runs-on: ubuntu-latest
34+
outputs:
35+
pull-request-number: ${{ steps.pr.outputs.pull-request-number }}
36+
version: ${{ steps.run.outputs.CRATES_VERSION }}
37+
steps:
38+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39+
with:
40+
fetch-depth: 0
41+
persist-credentials: false
42+
43+
- uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8
44+
with:
45+
cache-key: warm
46+
tools: cargo-release-oxc
47+
48+
- name: Run
49+
id: run
50+
run: |
51+
cargo ck
52+
cargo release-oxc update --release crates
53+
echo "CRATES_VERSION=$(cat ./target/CRATES_VERSION)" >> $GITHUB_OUTPUT
54+
{
55+
echo 'CHANGELOG<<EOF'
56+
cat ./target/CRATES_CHANGELOG
57+
echo EOF
58+
} >> $GITHUB_OUTPUT
59+
60+
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
61+
62+
# Run NAPI-RS build, because NAPI-RS uses version from `package.json` in the bindings file,
63+
# which is committed to the repo. The version has just been bumped in previous step.
64+
# We don't use the compiled `.node` binary, so only do a development build, as it's faster.
65+
- name: Rebuild NAPI packages bindings
66+
run: |
67+
pnpm --filter oxc-minify run build-dev
68+
pnpm --filter oxc-parser run build-dev
69+
pnpm --filter oxc-transform run build-dev
70+
71+
- name: Update Cargo.lock
72+
run: cargo check
73+
74+
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
75+
id: pr
76+
with:
77+
# bot account with PAT required for triggering workflow runs
78+
# See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
79+
token: ${{ secrets.OXC_BOT_PAT }}
80+
commit-message: "release(crates): oxc v${{ steps.run.outputs.CRATES_VERSION }}"
81+
title: "release(crates): oxc v${{ steps.run.outputs.CRATES_VERSION }}"
82+
branch: release/crates
83+
branch-suffix: timestamp
84+
base: main
85+
body: ${{ steps.run.outputs.CHANGELOG }}
86+
assignees: Boshen
3387

3488
ecosystem-ci:
3589
needs: prepare

.github/workflows/prepare_release_oxfmt.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/prepare_release_oxlint.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)