terraform-provider-towerops/.forgejo/workflows/release.yml

43 lines
1.4 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
fetch-depth: 0
- uses: https://code.forgejo.org/actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install GnuPG and GoReleaser
run: |
apt-get update
apt-get install -y gnupg curl
curl -sfL "https://github.com/goreleaser/goreleaser/releases/latest/download/goreleaser_Linux_x86_64.tar.gz" \
| tar -xz -C /usr/local/bin goreleaser
- name: Import GPG key
id: import_gpg
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: |
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
gpgconf --kill gpg-agent || true
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
FINGERPRINT=$(gpg --list-secret-keys --with-colons | awk -F: '/^fpr:/ {print $10; exit}')
echo "fingerprint=$FINGERPRINT" >> "$GITHUB_OUTPUT"
- name: Run GoReleaser
env:
GITEA_TOKEN: ${{ secrets.CODEBERG_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
run: |
unset GITHUB_TOKEN
goreleaser release --clean