From 49530cf643971506b2f9b6f905bec7f34c2997db Mon Sep 17 00:00:00 2001 From: Gianmarco Date: Mon, 12 Aug 2024 11:29:00 +0200 Subject: [PATCH] ci: simplify release.yaml --- .github/workflows/release.yaml | 66 +++++++++++++++------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a755e3a..7d9f0a5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,18 +6,29 @@ on: - "v[0-9]+.[0-9]+.[0-9]+" jobs: - prepare-release: - name: Prepare release + + update-changelog: + name: Create release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - name: "Checkout" - - name: GitHub Create Tag Release - uses: Roang-zero1/github-create-release-action@v3 - with: - version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - uses: requarks/changelog-action@v1 + name: "Update CHANGELOG" + id: changelog + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + - uses: softprops/action-gh-release@v2 + name: "Add changes to release notes" + with: + body: ${{ steps.changelog.outputs.changes }} + - name: Commit CHANGELOG.md + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: master + commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' + file_pattern: CHANGELOG.md + releases-matrix: name: Release Go Binary runs-on: ubuntu-latest @@ -30,15 +41,16 @@ jobs: - goarch: "386" goos: darwin steps: - - name: Get Release Info + - name: "Get Release Info" run: | echo "RELEASE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV echo "PACKAGE_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_ENV - echo "OS_NAME=${{ matrix.goos }}" >> $GITHUB_ENV - - name: OS darwin - if: matrix.goos == 'darwin' - run: echo "OS_NAME=macOS" >> $GITHUB_ENV + if [ "${{ matrix.goos }}" == "darwin" ]; then + echo "OS_NAME=macOS" >> $GITHUB_ENV + else + echo "OS_NAME=${{ matrix.goos }}" >> $GITHUB_ENV + fi - uses: actions/checkout@v3 - uses: wangyoucao577/go-release-action@v1.51 with: @@ -51,25 +63,5 @@ jobs: executable_compression: upx -v md5sum: false ldflags: '-X github.com/${{ env.PACKAGE_NAME }}/cmd.BuildVersion=${{ env.RELEASE_TAG }}' - update-changelog: - name: Update release notes - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - name: "Checkout" - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ github.token }} - tag: ${{ github.ref_name }} - - name: Add changes to release notes - uses: softprops/action-gh-release@v2 - with: - body: ${{ steps.changelog.outputs.changes }} - - name: Commit CHANGELOG.md - uses: stefanzweifel/git-auto-commit-action@v5 - with: - branch: master - commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' - file_pattern: CHANGELOG.md \ No newline at end of file + +