From 4071d4c35011c7a209e019e7b073e10c01e83fb2 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Tue, 23 Apr 2024 11:59:49 +0200 Subject: [PATCH] Go auto release workflows (#383) * Update workflows to go-auto-release * Update workflows to go-auto-release * Update workflows to go-auto-release * 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/release.yml | 46 +++++------------- .github/workflows/test.yml | 43 ++++++++++++----- .github/workflows/validate-codeowners.yml | 2 +- .goreleaser.yml | 59 ----------------------- 6 files changed, 42 insertions(+), 176 deletions(-) delete mode 100644 .github/auto-release.yml delete mode 100644 .github/workflows/auto-release.yml delete mode 100644 .goreleaser.yml 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/release.yml b/.github/workflows/release.yml index 3309c04..178c027 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,39 +1,15 @@ -# This GitHub action publish assets for release when a tag is created. -name: release +name: Release on: - push: - tags: - - "*" + release: + types: [published] - workflow_dispatch: +permissions: {} -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - with: - version: latest - args: release --parallelism 2 --rm-dist - env: - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +jobs: + perform: + uses: cloudposse/.github/.github/workflows/shared-release-branches.yml@main + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 904878c..171aa9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,10 +4,19 @@ on: types: [opened, synchronize, reopened] paths-ignore: - "README.md" - release: - types: [created] + push: + branches: + - main + - release/v* paths-ignore: - - "README.md" + - '.github/**' + - 'docs/**' + - 'examples/**' + - 'test/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false jobs: # ensure the code builds... @@ -16,15 +25,15 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + - name: Set up Go - uses: actions/setup-go@v3.3.0 + uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version-file: go.mod id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3.1.0 - - name: Get dependencies run: | go mod download @@ -50,15 +59,15 @@ jobs: - "1.5.7" - "1.6.3" steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + - name: Set up Go - uses: actions/setup-go@v3.3.0 + uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version-file: go.mod id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3.1.0 - - name: Get dependencies run: | make deps @@ -70,3 +79,11 @@ jobs: TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }} run: | make testacc + + release: + needs: test + if: github.event_name == 'push' + uses: cloudposse/.github/.github/workflows/shared-go-auto-release.yml@main + with: + publish: true + 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/.goreleaser.yml deleted file mode 100644 index 32c7322..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Visit https://goreleaser.com for documentation on how to customize this -# behavior. -before: - hooks: - # this is just an example and not a requirement for provider building/publishing - - go mod tidy - -builds: -- env: - # goreleaser does not work with CGO, it could also complicate - # usage by users in CI/CD systems like Terraform Cloud where - # they are unable to install libraries. - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' - flags: - - -trimpath - ldflags: - - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' - goos: - - freebsd - - windows - - linux - - darwin - goarch: - - amd64 - - '386' - - arm - - arm64 - ignore: - - goos: darwin - goarch: '386' - binary: '{{ .ProjectName }}_v{{ .Version }}' - -archives: -- format: zip - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' - -checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' - algorithm: sha256 - -signs: - - artifacts: checksum - args: - # since we are using this in a GitHub action we need to pass the batch flag to indicate its not interactive. - - "--batch" - - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - - "--output" - - "${signature}" - - "--detach-sign" - - "${artifact}" - -release: - # If you want to manually examine the release before its live, uncomment this line: - # draft: true - -changelog: - skip: true