swc/.github/workflows/bot.yml

140 lines
3.8 KiB
YAML
Raw Normal View History

name: Bot
on:
push:
branches:
- main
2022-05-08 11:55:51 +03:00
workflow_dispatch:
env:
GIT_COMMITTER_NAME: "SWC Bot"
GIT_COMMITTER_EMAIL: "bot@swc.rs"
jobs:
auto-rebase:
name: Auto rebase
runs-on: ubuntu-latest
concurrency: swc-bot-auto-rebase
steps:
- uses: actions/checkout@v3
with:
repository: "swc-project/swc"
ref: "main"
- uses: actions/setup-node@v3
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:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
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: ') }}
steps:
- uses: actions/checkout@v3
with:
repository: "swc-project/swc"
ref: "main"
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- 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
- 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
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
- name: Update lockfile
2022-02-16 09:22:11 +03:00
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
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'
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'
- uses: webfactory/ssh-agent@v0.5.4
2022-02-16 09:22:11 +03:00
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
with:
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
2022-02-16 08:36:45 +03:00
# Push back, using ssh
- name: Push back
2022-02-16 09:22:11 +03:00
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
run: |
2022-02-16 08:36:45 +03:00
git push git@github.com:swc-project/swc.git --no-verify
- name: Configure crates.io
2022-02-16 09:22:11 +03:00
if: steps.bump.outcome == 'success' && steps.bump.conclusion == 'success'
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'
run: |
npx ts-node src/cargo/update-constants.ts
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
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