From ec4297acf3c07db2796d800d55cc71f65c5efc66 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Mon, 22 Apr 2024 19:28:17 +0200 Subject: [PATCH] Go auto release workflows (#42) * Update workflows to go-auto-release * Update workflows to go-auto-release * Update workflows to go-auto-release * Update workflows to go-auto-release --- .github/auto-release.yml | 53 ----------------------- .github/workflows/auto-release.yml | 15 ------- .github/workflows/build.yml | 51 +++++++++++++--------- .github/workflows/release.yml | 15 +++++++ .github/workflows/validate-codeowners.yml | 2 +- .goreleaser.yml => dev.goreleaser.yml | 0 6 files changed, 47 insertions(+), 89 deletions(-) delete mode 100644 .github/auto-release.yml delete mode 100644 .github/workflows/auto-release.yml create mode 100644 .github/workflows/release.yml rename .goreleaser.yml => dev.goreleaser.yml (100%) diff --git a/.github/auto-release.yml b/.github/auto-release.yml deleted file mode 100644 index 17cd39c..0000000 --- a/.github/auto-release.yml +++ /dev/null @@ -1,53 +0,0 @@ -name-template: 'v$RESOLVED_VERSION' -tag-template: '$RESOLVED_VERSION' -version-template: '$MAJOR.$MINOR.$PATCH' -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - - 'enhancement' - patch: - labels: - - 'auto-update' - - 'patch' - - 'fix' - - 'bugfix' - - 'bug' - - 'hotfix' - default: 'minor' - -categories: -- title: '🚀 Enhancements' - labels: - - 'enhancement' - - 'patch' -- title: '🐛 Bug Fixes' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - 'hotfix' -- title: '🤖 Automatic Updates' - labels: - - 'auto-update' - -change-template: | -
- $TITLE @$AUTHOR (#$NUMBER) - - $BODY -
- -template: | - $CHANGES - -replacers: -# Remove irrelevant information from Renovate bot -- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm' - replace: '' -# Remove Renovate bot banner image -- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm' - replace: '' diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml deleted file mode 100644 index 0929676..0000000 --- a/.github/workflows/auto-release.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: auto-release - -on: - push: - branches: - - main - - master - - production - -jobs: - auto: - uses: cloudposse/.github/.github/workflows/shared-auto-release.yml@main - with: - publish: true - secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3bd0c4..8fdf3a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,11 +4,25 @@ on: pull_request: types: [ opened, synchronize, reopened ] - release: - types: [ published ] - workflow_dispatch: + push: + branches: + - main + - release/v* + paths-ignore: + - '.github/**' + - 'docs/**' + - 'examples/**' + - 'test/**' + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +permissions: {} + + jobs: build: name: 'Build Binaries' @@ -16,35 +30,32 @@ jobs: steps: # Checkout the repo - name: 'Checkout' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # Setup Go - name: 'Setup Go' - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version-file: go.mod # Print Go version - run: go version - # Build and release - - name: Build release - if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' && github.ref_name == 'master') - uses: goreleaser/goreleaser-action@v4 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Trial build - name: Test build - if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref_name != 'master') - uses: goreleaser/goreleaser-action@v4 + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref_name != 'main') + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest - args: release --clean --snapshot + args: release --config ./dev.goreleaser.yml --clean --snapshot + + release: + if: github.event_name == 'push' + needs: build + uses: cloudposse/.github/.github/workflows/shared-go-auto-release.yml@main + with: + publish: true + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..178c027 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,15 @@ +name: Release +on: + release: + types: [published] + +permissions: {} + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + perform: + uses: cloudposse/.github/.github/workflows/shared-release-branches.yml@main + secrets: inherit diff --git a/.github/workflows/validate-codeowners.yml b/.github/workflows/validate-codeowners.yml index b3f7c32..d97f0ce 100644 --- a/.github/workflows/validate-codeowners.yml +++ b/.github/workflows/validate-codeowners.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout source code at current commit" - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved - uses: mszostok/codeowners-validator@v0.7.1 if: github.event.pull_request.head.repo.full_name == github.repository diff --git a/.goreleaser.yml b/dev.goreleaser.yml similarity index 100% rename from .goreleaser.yml rename to dev.goreleaser.yml