From 242882173a7d2d6971fc42f9bbbaa17b2f477179 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 3 Nov 2023 16:12:18 +0100 Subject: [PATCH 1/8] build: rework build/release pipeline --- .../action.yml | 24 --- .github/workflows/build.yml | 36 +++++ .github/workflows/build_plugin_binaries.yml | 146 ------------------ ...notify-integration-release-via-manual.yaml | 46 ------ .../notify-integration-release-via-tag.yaml | 52 ------- .github/workflows/release.yml | 62 ++++---- .goreleaser.yml | 128 +++++---------- 7 files changed, 108 insertions(+), 386 deletions(-) delete mode 100644 .github/actions/build-and-persist-plugin-binary/action.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/build_plugin_binaries.yml delete mode 100644 .github/workflows/notify-integration-release-via-manual.yaml delete mode 100644 .github/workflows/notify-integration-release-via-tag.yaml diff --git a/.github/actions/build-and-persist-plugin-binary/action.yml b/.github/actions/build-and-persist-plugin-binary/action.yml deleted file mode 100644 index 4d358ddd..00000000 --- a/.github/actions/build-and-persist-plugin-binary/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -name: build-and-persist-plugin-binary -inputs: - GOOS: - required: true - GOARCH: - required: true -runs: - using: composite - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - run: "GOOS=${{ inputs.GOOS }} GOARCH=${{ inputs.GOARCH }} go build -o ./pkg/packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }} ." - shell: bash - - run: zip ./pkg/packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }}.zip ./pkg/packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }} - shell: bash - - run: rm ./pkg/packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }} - shell: bash - - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - name: "packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }}.zip" - path: "pkg/packer_plugin_hcloud_${{ inputs.GOOS }}_${{ inputs.GOARCH }}.zip" - retention-days: 30 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..94e94d13 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +# This GitHub action can publish assets for release when a tag is created. +# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). + +name: Build + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-go@v4 + with: + go-version: "1.20" + + - uses: goreleaser/goreleaser-action@v4 + with: + version: latest + args: release --clean --timeout 120m --snapshot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/upload-artifact@v3 + if: github.event_name == 'push' + with: + path: dist/build_*/* diff --git a/.github/workflows/build_plugin_binaries.yml b/.github/workflows/build_plugin_binaries.yml deleted file mode 100644 index b205ae9a..00000000 --- a/.github/workflows/build_plugin_binaries.yml +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -name: hashicorp/packer-plugin-hcloud/build_plugin_binaries -permissions: - contents: read -on: - push: - branches: - - main -jobs: - build_darwin: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: darwin - GOARCH: amd64 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: darwin - GOARCH: arm64 - build_freebsd: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: freebsd - GOARCH: 386 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: freebsd - GOARCH: amd64 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: freebsd - GOARCH: arm - build_linux: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: linux - GOARCH: 386 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: linux - GOARCH: amd64 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: linux - GOARCH: arm - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: linux - GOARCH: arm64 - build_netbsd: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: netbsd - GOARCH: 386 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: netbsd - GOARCH: amd64 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: netbsd - GOARCH: arm - build_openbsd: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: openbsd - GOARCH: 386 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: openbsd - GOARCH: amd64 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: openbsd - GOARCH: arm - build_solaris: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: solaris - GOARCH: amd64 - build_windows: - defaults: - run: - working-directory: ~/go/src/github.com/hetznercloud/packer-plugin-hcloud - runs-on: ubuntu-latest - container: - image: cimg/go:1.20 - steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: windows - GOARCH: 386 - - uses: "./.github/actions/build-and-persist-plugin-binary" - with: - GOOS: windows - GOARCH: amd64 diff --git a/.github/workflows/notify-integration-release-via-manual.yaml b/.github/workflows/notify-integration-release-via-manual.yaml deleted file mode 100644 index 6244065d..00000000 --- a/.github/workflows/notify-integration-release-via-manual.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: Notify Integration Release (Manual) -on: - workflow_dispatch: - inputs: - version: - description: "The release version (semver)" - default: 0.0.1 - required: false - branch: - description: "A branch or SHA" - default: 'main' - required: false -jobs: - notify-release: - runs-on: ubuntu-latest - steps: - - name: Checkout this repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - ref: ${{ github.event.inputs.branch }} - # Ensure that Docs are Compiled - - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 - - shell: bash - run: make generate - - shell: bash - run: | - if [[ -z "$(git status -s)" ]]; then - echo "OK" - else - echo "Docs have been updated, but the compiled docs have not been committed." - echo "Run 'make generate', and commit the result to resolve this error." - exit 1 - fi - # Perform the Release - - name: Checkout integration-release-action - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - repository: hashicorp/integration-release-action - path: ./integration-release-action - - name: Notify Release - uses: ./integration-release-action - with: - integration_identifier: "packer/hetznercloud/hcloud" - release_version: ${{ github.event.inputs.version }} - release_sha: ${{ github.event.inputs.branch }} - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/notify-integration-release-via-tag.yaml b/.github/workflows/notify-integration-release-via-tag.yaml deleted file mode 100644 index 42b6cdee..00000000 --- a/.github/workflows/notify-integration-release-via-tag.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Notify Integration Release (Tag) -on: - push: - tags: - - '*.*.*' # Proper releases -jobs: - strip-version: - runs-on: ubuntu-latest - outputs: - packer-version: ${{ steps.strip.outputs.packer-version }} - steps: - - name: Strip leading v from version tag - id: strip - env: - REF: ${{ github.ref_name }} - run: | - echo "packer-version=$(echo "$REF" | sed -E 's/v?([0-9]+\.[0-9]+\.[0-9]+)/\1/')" >> "$GITHUB_OUTPUT" - notify-release: - needs: - - strip-version - runs-on: ubuntu-latest - steps: - - name: Checkout this repo - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - ref: ${{ github.ref }} - # Ensure that Docs are Compiled - - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 - - shell: bash - run: make generate - - shell: bash - run: | - if [[ -z "$(git status -s)" ]]; then - echo "OK" - else - echo "Docs have been updated, but the compiled docs have not been committed." - echo "Run 'make generate', and commit the result to resolve this error." - exit 1 - fi - # Perform the Release - - name: Checkout integration-release-action - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - with: - repository: hashicorp/integration-release-action - path: ./integration-release-action - - name: Notify Release - uses: ./integration-release-action - with: - integration_identifier: "packer/hetznercloud/hcloud" - release_version: ${{ needs.strip-version.outputs.packer-version }} - release_sha: ${{ github.ref }} - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dcdbcd5..dfe3bc47 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,57 +3,55 @@ # This GitHub action can publish assets for release when a tag is created. # Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). -# -# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your -# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `GPG_PASSPHRASE` -# secret. If you would rather own your own GPG handling, please fork this action -# or use an alternative one for key handling. -# -# You will need to pass the `--batch` flag to `gpg` in your signing step -# in `goreleaser` to indicate this is being used in a non-interactive mode. -# -name: release + +name: Release on: push: - tags: - - "v*" - -permissions: - contents: write - packages: read + tags: [v*] jobs: - goreleaser: + release: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - - - name: Unshallow - run: git fetch --prune --unshallow + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 + - uses: actions/setup-go@v4 with: go-version: "1.20" - - name: Describe plugin - id: plugin_describe - 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@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0 + uses: crazy-max/ghaction-import-gpg@v5 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Describe plugin api_version + id: describe_plugin + run: echo "api_version=$(go run . describe | jq -r '.api_version')" >> "$GITHUB_OUTPUT" + - name: Run GoReleaser - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 + uses: goreleaser/goreleaser-action@v4 with: version: latest args: release --clean --timeout 120m env: - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - API_VERSION: ${{ steps.plugin_describe.outputs.api_version }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + API_VERSION: ${{ steps.describe_plugin.outputs.api_version }} + + notify-release: + needs: [release] + + runs-on: ubuntu-latest + steps: + - run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" + + - uses: hashicorp/integration-release-action@main + with: + integration_identifier: packer/hetznercloud/hcloud + release_version: ${{ env.RELEASE_VERSION }} + release_sha: ${{ github.sha }} + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 5ccbdfba..d7ea1a9d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,90 +1,50 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 -# This is an example goreleaser.yaml file with some defaults. -# Make sure to check the documentation at http://goreleaser.com -version: 1 - -env: - - CGO_ENABLED=0 - -before: - hooks: - # We strongly recommend running tests to catch any regression before release. - # Even though, this an optional step. - - go test ./... - # Check plugin compatibility with required version of the Packer SDK - - make plugin-check +# See http://goreleaser.com +# version: 1 builds: - # A separated build to run the packer-plugins-check only once for a linux_amd64 binary - - 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= " - goos: - - linux - goarch: - - amd64 - binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}" - - - id: linux-builds + - id: build mod_timestamp: "{{ .CommitTimestamp }}" + env: + - CGO_ENABLED=0 flags: - - -trimpath #removes all file system paths from the compiled executable + - -trimpath ldflags: - - "-s -w -X {{ .ModulePath }}/version.Version={{.Version}} -X {{ .ModulePath }}/version.VersionPrerelease= " - goos: - - linux - goarch: - - amd64 - - "386" - - arm - - arm64 - ignore: - - goos: linux - goarch: amd64 - binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}" + - -s + - -w + - -X {{ .ModulePath }}/version.Version={{ .Version }} + - -X {{ .ModulePath }}/version.VersionPrerelease= + binary: >- + {{- if .IsSnapshot -}} + {{ replace .ProjectName "-" "_" }}_{{ .Os }}_{{ .Arch }} + {{- else -}} + {{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }} + {{- end -}} - - id: darwin-builds - 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= " - goos: - - darwin - goarch: - - amd64 - - arm64 - binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}" + targets: + - linux_386 + - linux_amd64_v1 + - linux_arm_6 + - linux_arm64 + - freebsd_386 + - freebsd_amd64_v1 + - freebsd_arm + - netbsd_386 + - netbsd_amd64_v1 + - netbsd_arm + - openbsd_386 + - openbsd_amd64_v1 + - openbsd_arm + - solaris_amd64_v1 + - darwin_amd64_v1 + - darwin_arm64 + - windows_386 + - windows_amd64_v1 - - id: other-builds - 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= " - goos: - - netbsd - - openbsd - - freebsd - - windows - - solaris - goarch: - - amd64 - - "386" - - arm - ignore: - - goos: windows - goarch: arm - - goos: solaris - goarch: arm - - goos: solaris - goarch: "386" - binary: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}" +snapshot: + name_template: "{{ incpatch .RawVersion }}-dev+{{ .ShortCommit }}" archives: - format: zip @@ -99,12 +59,8 @@ checksum: signs: - artifacts: checksum args: - # if you are using this is in a GitHub action or some other automated pipeline, you - # need to pass the batch flag to indicate its not interactive. - - "--batch" - - "--local-user" - - "{{ .Env.GPG_FINGERPRINT }}" - - "--output" - - "${signature}" - - "--detach-sign" - - "${artifact}" + - --batch + - --local-user={{ .Env.GPG_FINGERPRINT }} + - --output=${signature} + - --detach-sign + - ${artifact} From c3e27a77a3b0eb59133707db3c9ea95a35fd4cce Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 08:54:31 +0100 Subject: [PATCH 2/8] build different snapshot archive name --- .goreleaser.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index d7ea1a9d..c0b99fad 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -50,7 +50,12 @@ archives: - format: zip files: - none* - name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }}" + name_template: >- + {{- if .IsSnapshot -}} + {{ replace .ProjectName "-" "_" }}_{{ .Os }}_{{ .Arch }} + {{- else -}} + {{ .ProjectName }}_v{{ .Version }}_{{ .Env.API_VERSION }}_{{ .Os }}_{{ .Arch }} + {{- end -}} checksum: name_template: "{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS" From 5c1b6b3eadd0b3053cefbbbdecf829b05f55bf29 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 09:00:34 +0100 Subject: [PATCH 3/8] build: set parsed tag version --- .goreleaser.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index c0b99fad..13af45c6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,8 +14,8 @@ builds: ldflags: - -s - -w - - -X {{ .ModulePath }}/version.Version={{ .Version }} - - -X {{ .ModulePath }}/version.VersionPrerelease= + - -X {{ .ModulePath }}/version.Version={{ .RawVersion }} + - -X {{ .ModulePath }}/version.VersionPrerelease={{ .Prerelease }} binary: >- {{- if .IsSnapshot -}} {{ replace .ProjectName "-" "_" }}_{{ .Os }}_{{ .Arch }} From a84ef8cabf1457c41d9a7918c9c2848f0637004d Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 09:10:27 +0100 Subject: [PATCH 4/8] build: do not sign snapshots --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94e94d13..5b998bd5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - uses: goreleaser/goreleaser-action@v4 with: version: latest - args: release --clean --timeout 120m --snapshot + args: release --clean --timeout 120m --snapshot --skip=sign env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2b1fe5f286fab14dc218224c6385981109993c71 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 09:10:57 +0100 Subject: [PATCH 5/8] ci: do not build on pull requests --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b998bd5..7ba07734 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ name: Build on: push: branches: [main] - pull_request: jobs: build: @@ -31,6 +30,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/upload-artifact@v3 - if: github.event_name == 'push' with: path: dist/build_*/* From bbcd56de251b15ac438dd3aab6c5e1bf219dfab4 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 09:12:12 +0100 Subject: [PATCH 6/8] build: upload archives --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ba07734..cecb5911 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,4 +31,4 @@ jobs: - uses: actions/upload-artifact@v3 with: - path: dist/build_*/* + path: dist/*.zip From 3c356a19c26b37dacfdd2d6d237ff0828443c102 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 11:34:21 +0100 Subject: [PATCH 7/8] ci: use gpg passphrase to unlock gpg private key --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfe3bc47..09c3be32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ jobs: uses: crazy-max/ghaction-import-gpg@v5 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Describe plugin api_version id: describe_plugin From 6cbfcda66c3e70a2f88972596b122a5487b85a55 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 6 Nov 2023 11:59:59 +0100 Subject: [PATCH 8/8] build: new version handling logic --- .goreleaser.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 13af45c6..44ed3aa8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,8 +14,8 @@ builds: ldflags: - -s - -w - - -X {{ .ModulePath }}/version.Version={{ .RawVersion }} - - -X {{ .ModulePath }}/version.VersionPrerelease={{ .Prerelease }} + - -X {{ .ModulePath }}/version.Version={{ .Version }} + - -X {{ .ModulePath }}/version.VersionPrerelease={{- if .IsSnapshot -}}dev+{{ .ShortCommit }}{{- end -}} binary: >- {{- if .IsSnapshot -}} {{ replace .ProjectName "-" "_" }}_{{ .Os }}_{{ .Arch }} @@ -44,7 +44,7 @@ builds: - windows_amd64_v1 snapshot: - name_template: "{{ incpatch .RawVersion }}-dev+{{ .ShortCommit }}" + name_template: "{{ .Version }}-dev+{{ .ShortCommit }}" archives: - format: zip