0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-03 03:52:58 +00:00

update release workflow & goreleaser config

This commit is contained in:
Pavel Boldyrev 2021-09-09 15:02:12 -04:00
parent 205e2550f9
commit 1069f989a1
No known key found for this signature in database
GPG Key ID: 9A3B05A2B8921AD9
2 changed files with 66 additions and 74 deletions

View File

@ -1,62 +1,48 @@
name: Create release # 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 `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
on: on:
push: push:
tags: tags:
- 'v*' - 'v*'
jobs: jobs:
release: goreleaser:
name: Tag runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps: steps:
- - name: Checkout
name: Checkout the code
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
fetch-depth: 0 - name: Unshallow
- run: git fetch --prune --unshallow
name: Install and configure Go
- name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.15 go-version: 1.16
-
name: Install and configure GoReleaser - name: Import GPG key
env: id: import_gpg
GORELEASER_VERSION: '0.155.1' uses: crazy-max/ghaction-import-gpg@v4
run: | with:
curl -sL -o goreleaser_amd64.deb "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb" git_user_signingkey: true
sudo dpkg -i goreleaser_amd64.deb gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
rm -f goreleaser_amd64.deb passphrase: ${{ secrets.PASSPHRASE }}
-
name: Import the GPG signing key - name: Run GoReleaser
env: uses: goreleaser/goreleaser-action@v2.7.0
GPG_KEY: ${{ secrets.GPG_KEY }} with:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} version: latest
run: | args: release --rm-dist
mkdir -p ~/.gnupg
chmod 0700 ~/.gnupg
cat << EOF > ~/.gnupg/gpg.conf
use-agent
pinentry-mode loopback
EOF
echo "$GPG_KEY" | base64 -d | gpg --batch --allow-secret-key-import --import
gpg --keyid-format LONG --list-secret-keys
cat << EOF > ~/.gnupg/gpg-agent.conf
default-cache-ttl 7200
max-cache-ttl 31536000
allow-loopback-pinentry
allow-preset-passphrase
EOF
echo RELOADAGENT | gpg-connect-agent
printf '%s' "$GPG_PASSPHRASE" > /tmp/.gpg_passphrase
-
name: Create release
env: env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
# GitHub sets this automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
run: |
goreleaser release --parallelism 2 --rm-dist --timeout 1h

View File

@ -1,43 +1,44 @@
archives: # Visit https://goreleaser.com for documentation on how to customize this
- files: # behavior.
- none*
format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
before: before:
hooks: hooks:
- go mod download - go mod download
builds: builds:
- binary: '{{ .ProjectName }}_{{ .Version }}' - 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: flags:
- -trimpath - -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch: goarch:
- '386'
- amd64 - amd64
- '386'
- arm - arm
- arm64 - arm64
goos:
- darwin
- freebsd
- linux
- windows
ignore: ignore:
- goarch: '386' - goos: darwin
goos: darwin goarch: '386'
ldflags: binary: '{{ .ProjectName }}_v{{ .Version }}'
- -s -w -X version.ProviderVersion={{.Version}} archives:
mod_timestamp: '{{ .CommitTimestamp }}' - format: zip
changelog: name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
skip: true
checksum: checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256 algorithm: sha256
env:
- CGO_ENABLED=0
release:
disable: true
signs: signs:
- artifacts: checksum - artifacts: checksum
args: args:
# if you are using this in a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch" - "--batch"
- "--local-user" - "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
@ -45,3 +46,8 @@ signs:
- "${signature}" - "${signature}"
- "--detach-sign" - "--detach-sign"
- "${artifact}" - "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
draft: true
changelog:
skip: true