2022-04-25 13:21:34 +03:00
|
|
|
name: Bot
|
2022-02-14 13:49:21 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-05-08 11:55:51 +03:00
|
|
|
workflow_dispatch:
|
2022-02-15 13:35:59 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
GIT_COMMITTER_NAME: "SWC Bot"
|
|
|
|
GIT_COMMITTER_EMAIL: "bot@swc.rs"
|
2022-02-14 13:49:21 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
auto-rebase:
|
|
|
|
name: Auto rebase
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency: swc-bot-auto-rebase
|
|
|
|
steps:
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-14 13:49:21 +03:00
|
|
|
with:
|
|
|
|
repository: "swc-project/swc"
|
|
|
|
ref: "main"
|
|
|
|
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-02-14 13:49:21 +03:00
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
working-directory: scripts/bot
|
|
|
|
run: |
|
|
|
|
yarn
|
|
|
|
|
|
|
|
- name: Rebase a PR
|
|
|
|
working-directory: scripts/bot
|
|
|
|
run: |
|
|
|
|
npx ts-node src/auto-rebase.ts
|
|
|
|
env:
|
2022-02-14 20:18:29 +03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
2022-02-15 13:35:59 +03:00
|
|
|
|
|
|
|
bump-crates:
|
|
|
|
name: Create cargo bump commit
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency: swc-bot-cargo-bump
|
2022-05-08 11:55:51 +03:00
|
|
|
if: >-
|
|
|
|
${{ github.event_name == 'push' && !contains(github.event.head_commit.message, 'chore: ') }}
|
2022-02-15 13:35:59 +03:00
|
|
|
steps:
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-15 13:35:59 +03:00
|
|
|
with:
|
|
|
|
repository: "swc-project/swc"
|
|
|
|
ref: "main"
|
2022-02-16 15:00:13 +03:00
|
|
|
fetch-depth: 0
|
2022-02-15 13:35:59 +03:00
|
|
|
|
2022-05-04 13:04:48 +03:00
|
|
|
- uses: actions/setup-node@v3
|
2022-02-15 13:35:59 +03:00
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
2022-08-13 09:38:09 +03:00
|
|
|
- name: Install latest nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
|
|
|
|
2022-02-15 13:35:59 +03:00
|
|
|
- name: Install node dependencies
|
|
|
|
working-directory: scripts/bot
|
|
|
|
run: |
|
|
|
|
yarn
|
|
|
|
|
2022-02-16 08:12:22 +03:00
|
|
|
- name: Install cargo-mono
|
|
|
|
uses: baptiste0928/cargo-install@v1.1.0
|
|
|
|
with:
|
|
|
|
crate: cargo-mono
|
|
|
|
version: "0.3.1"
|
2022-08-12 11:31:26 +03:00
|
|
|
locked: true
|
2022-02-16 08:12:22 +03:00
|
|
|
|
|
|
|
- name: Install git-cliff
|
|
|
|
uses: baptiste0928/cargo-install@v1.1.0
|
|
|
|
with:
|
|
|
|
crate: git-cliff
|
2022-02-16 09:04:00 +03:00
|
|
|
version: "0.4.2"
|
2022-08-12 11:31:26 +03:00
|
|
|
locked: true
|
2022-02-15 13:35:59 +03:00
|
|
|
|
|
|
|
- name: Bump crates
|
2022-02-16 08:36:45 +03:00
|
|
|
id: bump
|
2022-02-16 09:11:04 +03:00
|
|
|
continue-on-error: true
|
2022-02-15 13:35:59 +03:00
|
|
|
working-directory: scripts/bot
|
|
|
|
run: |
|
|
|
|
npx ts-node src/cargo/bump.ts
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
|
|
|
2022-02-16 08:36:45 +03:00
|
|
|
- name: Update changelog
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-16 08:36:45 +03:00
|
|
|
run: |
|
|
|
|
yarn changelog
|
|
|
|
|
2022-02-15 13:35:59 +03:00
|
|
|
- name: Update lockfile
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-15 13:35:59 +03:00
|
|
|
run: |
|
|
|
|
cargo metadata --format-version 1 > /dev/null
|
|
|
|
|
|
|
|
- name: Create commit
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-15 13:35:59 +03:00
|
|
|
run: |
|
|
|
|
git add -A
|
2022-04-17 19:01:16 +03:00
|
|
|
git commit --no-verify --author="SWC Bot <bot@swc.rs>" -m 'chore: Publish crates'
|
2022-02-15 13:35:59 +03:00
|
|
|
|
2022-02-16 08:00:55 +03:00
|
|
|
- uses: webfactory/ssh-agent@v0.5.4
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-16 08:00:55 +03:00
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
|
|
|
|
|
2022-02-16 08:36:45 +03:00
|
|
|
# Push back, using ssh
|
2022-02-15 13:35:59 +03:00
|
|
|
- name: Push back
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-15 13:35:59 +03:00
|
|
|
run: |
|
2022-02-16 08:36:45 +03:00
|
|
|
git push git@github.com:swc-project/swc.git --no-verify
|
2022-02-15 13:35:59 +03:00
|
|
|
|
|
|
|
- name: Configure crates.io
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-15 13:35:59 +03:00
|
|
|
run: |
|
|
|
|
cargo login $CARGO_TOKEN
|
|
|
|
env:
|
|
|
|
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
|
|
|
|
|
|
|
|
- name: Publish crates
|
2022-02-16 09:22:11 +03:00
|
|
|
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
|
2022-02-15 13:35:59 +03:00
|
|
|
run: |
|
2022-08-18 07:29:19 +03:00
|
|
|
npx ts-node src/cargo/update-constants.ts
|
2022-02-15 13:35:59 +03:00
|
|
|
cargo mono publish --no-verify
|
2022-02-28 13:44:06 +03:00
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
2022-05-08 11:55:51 +03:00
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|
|
|
|
cargo mono publish --no-verify
|