Skip to content

chore: Add choco API key #24

chore: Add choco API key

chore: Add choco API key #24

Workflow file for this run

# .github/workflows/release.yml
name: goreleaser
on:
pull_request:
push:
# run only against tags
tags:
- "*"
permissions:
contents: write
jobs:
goreleaser:
name: Release Chocolatey
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Prepare environment for Chocolatey
run: |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin"
[Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine")
- name: Install gpg4win
run: |
choco install --verbose gpg4win
- name: Locate GPG and Update PATH
run: |
$gpgPath = Get-Command gpg.exe | Select-Object -ExpandProperty Source
$gpgDir = Split-Path $gpgPath
echo "GPG_DIR=$gpgDir" >> $GITHUB_ENV
echo "$gpgDir" >> $env:GITHUB_PATH
- name: Create symbolic link for gpg2
run: |
$gpgPath = (Get-Command gpg.exe).Source
$gpg2Path = [System.IO.Path]::Combine((Split-Path $gpgPath), 'gpg2.exe')
if (-Not (Test-Path $gpg2Path)) {
New-Item -ItemType SymbolicLink -Path $gpg2Path -Target $gpgPath
}
shell: powershell
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser for Chocolatey
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: ${{ github.event_name == 'pull_request' && 'release --snapshot --clean --skip=announce' || 'release --clean --skip=announce' }}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}