Skip to content

Commit

Permalink
sync workflow and goreleaser cfg from scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaluk committed May 23, 2024
1 parent de7965f commit 12e583c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,49 @@ name: release
on:
push:
tags:
- 'v*'
- "v*"
permissions:
contents: write
packages: read
jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: "Determine Go version"
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
goreleaser:
needs:
- get-go-version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.22
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Describe plugin
id: plugin_describe
run: echo "::set-output name=api_version::$(go run . describe | jq -r '.api_version')"
run: echo "api_version=$(go run . describe | jq -r '.api_version')" >> $GITHUB_OUTPUT
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
with:
version: latest
args: release --rm-dist
args: release --clean --timeout 120m
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.22.3
36 changes: 17 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,27 @@ before:
- go test ./...
# As part of the release doc files are included as a separate deliverable for
# consumption by Packer.io. To include a separate docs.zip uncomment the following command.
- make ci-release-docs
#- make ci-release-docs
# Check plugin compatibility with required version of the Packer SDK
- make plugin-check
builds:
# A separated build to run the packer-plugins-check only once for a linux_amd64 binary
-
id: plugin-check
mod_timestamp: '{{ .CommitTimestamp }}'
- id: plugin-check
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath #removes all file system paths from the compiled executable
ldflags:
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
goos:
- linux
goarch:
- amd64
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
-
mod_timestamp: '{{ .CommitTimestamp }}'
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
- mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath #removes all file system paths from the compiled executable
ldflags:
- '-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= '
- "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= "
goos:
- netbsd
- solaris
Expand All @@ -42,24 +40,24 @@ builds:
- darwin
goarch:
- amd64
- '386'
- "386"
- arm
- arm64
ignore:
- goos: openbsd
goarch: arm64
- goos: darwin
goarch: '386'
goarch: "386"
- goos: linux
goarch: amd64
binary: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
archives:
- format: zip
files:
- none*
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}'
- format: zip
files:
- none*
name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS'
name_template: "{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS"
algorithm: sha256
signs:
- artifacts: checksum
Expand All @@ -78,8 +76,8 @@ release:
# draft: true
# As part of the release doc files are included as a separate deliverable for consumption by Packer.io.
# To include a separate docs.zip uncomment the extra_files config and the docs.zip command hook above.
extra_files:
- glob: ./docs.zip
#extra_files:
#- glob: ./docs.zip

changelog:
skip: true

0 comments on commit 12e583c

Please sign in to comment.