Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added go releaser workflow #69

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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:
draft: true
replace_existing_draft: true
replace_existing_artifacts: true
mode: keep-existing
make_latest: false
name_template: 'v{{.Tag}}'
target_commitish: "{{ .Branch }}"
# If you want to manually examine the release before its live, uncomment this line:
# draft: true

changelog:
skip: true
7 changes: 7 additions & 0 deletions .github/workflows/shared-auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ on:
required: false
default: false
type: string
disable-releaser:
description: |
A boolean indicating whether the releaser mode is disabled.
required: false
default: 'false'
runs-on:
description: "Overrides job runs-on setting (json-encoded list)"
type: string
required: false
default: '["ubuntu-latest"]'

outputs:
id:
description: The ID of therelease that was created or updated.
Expand Down Expand Up @@ -98,5 +104,6 @@ jobs:
token: ${{ steps.github-app.outputs.token }}
publish: ${{ inputs.publish }}
prerelease: ${{ inputs.prerelease }}
disable-releaser: ${{ inputs.disable-releaser }}
latest: ${{ steps.context.outputs.latest }}
config-name: ${{ steps.context.outputs.config }}
22 changes: 12 additions & 10 deletions .github/workflows/shared-tf-provider-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
default: '["ubuntu-latest"]'
version:
description: "Release version tag"
required: false
default: ${{ github.event.release.tag_name }}
required: true
type: string
permissions: {}

Expand All @@ -35,19 +34,22 @@ jobs:

- name: Unshallow
run: |-
git fetch --prune --unshallow
git fetch --prune --unshallow
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git tag -a -m "Release ${{ needs.draft_release.outputs.tag_name }}" ${{ inputs.version }}

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22"

# - name: Import GPG key
# id: import_gpg
# uses: crazy-max/ghaction-import-gpg@v5
# with:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}

- name: Check disk space before
shell: bash
Expand All @@ -70,7 +72,7 @@ jobs:
version: latest
args: release --clean --parallelism 2 --timeout 180m --debug --verbose
env:
# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ steps.github-app.outputs.token }}

- name: Check disk space after
Expand Down
Loading