From 1db25668c0a04d2eb43fc2c5cb9e317a7ef22d26 Mon Sep 17 00:00:00 2001 From: black-desk Date: Sat, 31 Aug 2024 23:46:19 +0800 Subject: [PATCH] ci: rewrite workflows Signed-off-by: black-desk --- .github/workflows/auto_prerelease.yaml | 35 +++++++++++++++++++ ...autotag.yaml => auto_tag_and_release.yaml} | 17 +++++---- .github/workflows/prerelease.yaml | 28 --------------- 3 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/auto_prerelease.yaml rename .github/workflows/{autotag.yaml => auto_tag_and_release.yaml} (88%) delete mode 100644 .github/workflows/prerelease.yaml diff --git a/.github/workflows/auto_prerelease.yaml b/.github/workflows/auto_prerelease.yaml new file mode 100644 index 0000000..1e2188b --- /dev/null +++ b/.github/workflows/auto_prerelease.yaml @@ -0,0 +1,35 @@ +name: Automatic pre-release + +on: + push: + tags: ["v*-*"] + +jobs: + auto_pre_release: + name: Automatic pre-release + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # NOTE: + # Some automatic release action + # might need history for generate change log. + fetch-depth: 0 + + - name: Run actions/setup-go + uses: actions/setup-go@v5 + with: + go-version: stable + cache: true + + - name: Run goreleaser/goreleaser-action + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/autotag.yaml b/.github/workflows/auto_tag_and_release.yaml similarity index 88% rename from .github/workflows/autotag.yaml rename to .github/workflows/auto_tag_and_release.yaml index 3431236..3d496f6 100644 --- a/.github/workflows/autotag.yaml +++ b/.github/workflows/auto_tag_and_release.yaml @@ -41,26 +41,25 @@ jobs: new_tag: ${{ steps.autotag.outputs.new_tag }} auto_release: - permissions: - contents: write name: Automatic release for new tag - runs-on: ubuntu-latest needs: - auto_tag + if: needs.auto_tag.outputs.new_tag + permissions: + contents: write + runs-on: ubuntu-latest steps: - name: Checkout repository - if: needs.auto_tag.outputs.new_tag uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup go - if: needs.auto_tag.outputs.new_tag + - name: Run actions/setup-go uses: actions/setup-go@v5 with: - go-version: 'stable' + go-version: stable cache: true - - uses: goreleaser/goreleaser-action@v6 - if: needs.auto_tag.outputs.new_tag + - name: Run goreleaser/goreleaser-action + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest diff --git a/.github/workflows/prerelease.yaml b/.github/workflows/prerelease.yaml deleted file mode 100644 index 96c0c91..0000000 --- a/.github/workflows/prerelease.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Automatic prerelease powered by goreleaser" - -on: - push: - tags: - - 'v*-*' - -permissions: - contents: write - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: 'stable' - cache: true - - uses: goreleaser/goreleaser-action@v6 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}