Skip to content

Commit 2943f12

Browse files
authored
chore(ci): Experiment with auto-update (#117)
This PR trying to experiment with automated action to create a PR to upgrade swc_* when a new version is released. It is an action that runs periodically (2 times a day) which runs `cargo upgrade`, then create a PR if there's an update to be applied. If there is an open PR with a specific branch name, it won't create a new one but try to update the PR with a new commit when there's an update. To create a fully working pull request, action requires personal access token, unfortunately. I choose the name `GHA_UPGRADE_TOKEN` for those having one under repository secrets will enable the action to perform: We can use the default `GITHUB_TOKEN` still, but it'll create PR with limited access to github-actions bot and will not trigger any action to verify build is passing or not. (ref: peter-evans/create-pull-request#48) My goal is to let these actions run across transitive dependencies we own, so most of the upgrade process is simple enough to click the merge button unless there are breaking changes.
1 parent 9ff6ccf commit 2943f12

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Bump up swc_core
2+
on:
3+
schedule:
4+
# two times daily, at 12:00 and 06:00
5+
- cron: '0 0 * * *'
6+
- cron: '0 6 * * *'
7+
8+
jobs:
9+
upgrade-swc-core:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
17+
- uses: actions/cache@v3
18+
with:
19+
path: |
20+
~/.cargo/bin/
21+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
22+
23+
- name: Install Rust
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
profile: minimal
27+
override: true
28+
29+
- uses: Swatinem/rust-cache@v2
30+
with:
31+
shared-key: "gha-cargo-upgrade"
32+
cache-on-failure: true
33+
34+
- name: Run cargo upgrade
35+
uses: kwonoj/gha-cargo-upgrade@latest
36+
with:
37+
token: ${{ secrets.GHA_UPGRADE_TOKEN }}
38+
packages: "swc_core,swc_common,testing"
39+
incompatible: true

0 commit comments

Comments
 (0)