From c121e1b8e140b0bcb3268c681febd1e404f53433 Mon Sep 17 00:00:00 2001 From: lisonge Date: Mon, 4 Sep 2023 18:11:22 +0800 Subject: [PATCH] chore: actions release --- .github/workflows/build.yml | 48 ++++++++++++++++++++++++++++ .github/workflows/check.yml | 27 ++++++++++++++++ .github/workflows/release-please.yml | 19 +++++++++++ 3 files changed, 94 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..a5946fbf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + branches: + - 'main' + +jobs: + release: + if: | + ${{ contains(github.event.head_commit.message, 'chore: release') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: volta-cli/action@v3 + + - uses: pnpm/action-setup@v2 + + - run: pnpm install + + - name: Release + run: | + pnpm run build + + - name: Git commit + id: commit + run: | + git config --local user.email github-actions[bot]@users.noreply.github.com + git config --local user.name github-actions[bot] + git config --global core.autocrlf true + git config --global core.safecrlf false + git add . + git commit -m "CI build" -a + continue-on-error: true + + - name: Git push + uses: ad-m/github-push-action@master + if: ${{ steps.commit.outcome == 'success' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + + - name: Log + if: ${{ steps.commit.outcome != 'success' }} + run: echo Nothing to commit. diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 00000000..f5eceb6a --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,27 @@ +name: Check + +on: + push: + branches: + - '**' + pull_request: + branches: + - main + +jobs: + check: + runs-on: ubuntu-latest + if: | + ${{ !contains(github.event.head_commit.message, 'chore: release') }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: volta-cli/action@v3 + + - uses: pnpm/action-setup@v2 + + - run: pnpm install + + - run: pnpm run check diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..6f342afa --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,19 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + with: + release-type: node + package-name: release-please-action