Skip to content

Publish Shims

Publish Shims #52

Workflow file for this run

name: Publish Shims
# No `release: published` trigger — release-binaries.yml dispatches this via
# `gh workflow run` once binaries are actually uploaded. Avoids racing a
# fixed-budget wait against a build that may need a retry (see CLAUDE.md).
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish shims for (e.g. v0.39.0)"
required: true
permissions: {}
env:
ARCHGATE_TELEMETRY: "0"
jobs:
# Sanity-check assets are present (covers GitHub API read-after-write lag).
wait-for-binaries:
name: Wait for binaries
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Verify release assets are present
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
REQUIRED_ASSETS=("archgate-darwin-arm64.tar.gz" "archgate-linux-x64.tar.gz" "archgate-win32-x64.zip" "archgate-shim-win32-x64.exe")
for i in $(seq 1 10); do
ASSETS=$(gh release view "$TAG" --repo archgate/cli --json assets --jq '.assets[].name')
ALL_FOUND=true
for asset in "${REQUIRED_ASSETS[@]}"; do
if ! echo "$ASSETS" | grep -qF "$asset"; then
ALL_FOUND=false
break
fi
done
if $ALL_FOUND; then
echo "All required release assets found"
exit 0
fi
echo "Waiting for release assets... attempt $i/10"
sleep 15
done
echo "::error::Required binaries for $TAG are still missing after 10 checks (~2.5 min)."
echo "::error::This workflow expects release-binaries.yml to have already succeeded for this tag."
echo "::error::Check the Release Binaries run for $TAG, then re-run: gh workflow run publish-shims.yml -f tag=$TAG"
exit 1
publish-pypi:
needs: wait-for-binaries
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
id-token: write # PyPI trusted publishers (OIDC)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag }}
persist-credentials: false
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: "3.12"
# No cache in a publish workflow — a poisoned cache entry could end up
# inside the published artifact (zizmor: cache-poisoning).
enable-cache: false
- name: Build package
working-directory: shims/pypi
# `uv build` provisions an isolated, version-pinned build environment
# itself — no unpinned `pip install build` (Scorecard Pinned-Dependencies).
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
packages-dir: shims/pypi/dist/
publish-nuget:
needs: wait-for-binaries
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
id-token: write # NuGet trusted publishers (OIDC)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag }}
persist-credentials: false
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: "8.0.x"
- name: NuGet login (OIDC)
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
id: nuget-login
with:
user: rhuan.barreto
- name: Pack and publish
working-directory: shims/nuget/Archgate.Tool
env:
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
run: |
dotnet pack -c Release
dotnet nuget push bin/Release/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key "$NUGET_API_KEY"
publish-go-tag:
needs: wait-for-binaries
runs-on: ubuntu-latest
timeout-minutes: 5
# contents: write is required to push a tag. See
# project_release_pipeline_gotchas.md for why there's no "workflows" scope.
permissions:
contents: write
steps:
# Credentials must persist: the next step pushes the Go module tag via git.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # zizmor: ignore[artipacked]
with:
ref: ${{ inputs.tag }}
- name: Create Go module tag
env:
TAG: ${{ inputs.tag }}
run: |
GO_TAG="shims/go/${TAG}"
git tag "$GO_TAG"
git push origin "$GO_TAG"
publish-maven:
needs: wait-for-binaries
runs-on: ubuntu-latest
timeout-minutes: 15
permissions: {}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag }}
persist-credentials: false
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: "temurin"
java-version: "11"
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build and publish
working-directory: shims/maven
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
mvn clean deploy -P release -B --no-transfer-progress
# Submits a manifest update PR to microsoft/winget-pkgs. It fails loudly rather
# than continue-on-error: the other publish jobs only depend on
# wait-for-binaries, so a winget failure never blocks them, and a silent
# failure would let winget drift versions behind unnoticed.
publish-winget:
needs: wait-for-binaries
runs-on: windows-latest
timeout-minutes: 15
permissions: {}
steps:
- name: Submit manifest update to winget-pkgs
shell: pwsh
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
TAG: ${{ inputs.tag }}
run: |
if (-not $env:WINGET_TOKEN) {
Write-Host "::warning::WINGET_TOKEN is not configured - skipping winget submission."
Write-Host "::warning::Set that secret once Archgate.Archgate is accepted into winget-pkgs."
exit 0
}
$version = $env:TAG -replace '^v', ''
$url = "https://github.com/archgate/cli/releases/download/$env:TAG/archgate-shim-win32-x64.exe"
# aka.ms/wingetcreate/latest is Microsoft's documented download
# endpoint for wingetcreate, the official manifest submission tool.
Invoke-WebRequest -Uri https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update Archgate.Archgate --version $version --urls $url --submit --token $env:WINGET_TOKEN
if ($LASTEXITCODE -ne 0) {
Write-Error "wingetcreate exited with code $LASTEXITCODE"
exit 1
}
publish-rubygem:
needs: wait-for-binaries
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
id-token: write # RubyGems trusted publishers (OIDC)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.tag }}
persist-credentials: false
- uses: ruby/setup-ruby@a0102e0972be65f351c307e2d64b9314a57c8073 # v1.324.0
with:
ruby-version: "4.0.7"
# No bundler cache in a publish workflow — a poisoned cache entry could
# end up inside the published gem (zizmor: cache-poisoning).
bundler-cache: false
working-directory: shims/rubygem
- name: Install dependencies
working-directory: shims/rubygem
run: bundle install --jobs 4
- uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
with:
working-directory: shims/rubygem