Skip to content

feat(ci): auto-trigger chocolatey and winget publish on release (#118) #26

feat(ci): auto-trigger chocolatey and winget publish on release (#118)

feat(ci): auto-trigger chocolatey and winget publish on release (#118) #26

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g., v1.0.0)'
required: true
type: string
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name || inputs.tag }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG }}
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
# TAP_GITHUB_TOKEN (PAT) is required here instead of the default
# GITHUB_TOKEN because releases created with GITHUB_TOKEN do not fire
# downstream workflow triggers (release: published). Using the PAT
# lets chocolatey-publish.yml and winget-publish.yml auto-trigger.
GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
# Chocolatey and winget publishing live in chocolatey-publish.yml and
# winget-publish.yml respectively. They auto-trigger on `release: published`
# (and still expose `workflow_dispatch` as a manual fallback). They are kept
# out of this workflow so Microsoft-hosted service flakiness (wingetcreate
# fork-sync, choco push) does not gate the binary/Homebrew artifacts.
snap:
if: false # Temporarily disabled - waiting for personal-files interface approval
needs: goreleaser
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name || inputs.tag }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG }}
fetch-depth: 0
- name: Set snap version from tag
run: |
VERSION="${TAG#v}"
sed -i "s/^version: git$/version: '${VERSION}'/" snap/snapcraft.yaml
echo "Snap version: ${VERSION}"
grep '^version:' snap/snapcraft.yaml
- name: Build snap
uses: snapcore/action-build@v1
id: build
- name: Publish to Snapcraft Store
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.build.outputs.snap }}
release: stable
linux-packages:
needs: goreleaser
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Trigger linux-packages repo update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.LINUX_PACKAGES_DISPATCH_TOKEN }}
repository: open-cli-collective/linux-packages
event-type: package-release
client-payload: |-
{
"package": "google-readonly",
"version": "${{ github.ref_name }}",
"repo": "open-cli-collective/google-readonly"
}