Repository navigation
218 lines (205 loc) · 8.09 KB
/
Copy pathpublish-shims.yml
File metadata and controls
218 lines (205 loc) · 8.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
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-darwin-x64.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 -qxF "$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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.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@651ff0d62c5c79bed6d53ec518387aae20e72c1a # v1.329.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