From e2a0edd49d47e43f93716a6435fdd7eb2dac1405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 7 Oct 2021 16:07:55 +0900 Subject: [PATCH] chore: Setup workfllow to bump version (#2368) --- .github/workflows/bump-version.yml | 66 +++++++++++++++++++++++++++++ .github/workflows/publish-cargo.yml | 17 ++++++-- 2 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/bump-version.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 00000000000..5c536a920c1 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,66 @@ +name: Managment + +on: + workflow_dispatch: + inputs: + crate: + description: "Crate to bump version" + required: true + breaking: + description: "`1` if this is a breaking change" + required: true + default: "0" + +jobs: + bump: + name: Bump version + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: cargo-bump-version + + - name: Install cargo-mono + continue-on-error: true + run: | + cargo install cargo-mono + + - name: Bump version + run: | + if [ "${{ github.event.inputs.breaking }}" == "1" ]; then + cargo mono bump ${{ github.event.inputs.crate }}" + else + cargo mono bump ${{ github.event.inputs.crate }}" + fi + + - name: Update lockfile + run: | + cargo metadata + + - name: Configure git + run: | + git config --local user.email "bot@swc.rs" + git config --local user.name "swc[bot]" + + - name: Add files + run: | + git add -A + + - name: Commit files + run: | + git commit -m 'Bump version' + + - name: Push back + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/.github/workflows/publish-cargo.yml b/.github/workflows/publish-cargo.yml index 6f4adee61ff..a8e45856dbd 100644 --- a/.github/workflows/publish-cargo.yml +++ b/.github/workflows/publish-cargo.yml @@ -1,16 +1,27 @@ on: workflow_dispatch -name: Publish crates +name: Managment jobs: - publish-all: - name: Publish + publish-crates: + name: Publish crates runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: cargo-publish-crates + - name: Install cargo-mono + continue-on-error: true run: | cargo install cargo-mono