This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
220 lines (185 loc) · 8.13 KB
/
release.yml
File metadata and controls
220 lines (185 loc) · 8.13 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
219
220
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
chocolatey:
if: false # Temporarily disabled - waiting for v0.9.9 moderation approval
needs: goreleaser
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get checksums from release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download "${{ github.ref_name }}" --pattern "checksums.txt" --dir .
$checksums = Get-Content checksums.txt
$x64Hash = ($checksums | Select-String "windows_amd64.zip").Line.Split()[0]
$arm64Hash = ($checksums | Select-String "windows_arm64.zip").Line.Split()[0]
Write-Host "x64 SHA256: $x64Hash"
Write-Host "arm64 SHA256: $arm64Hash"
echo "X64_HASH=$x64Hash" >> $env:GITHUB_ENV
echo "ARM64_HASH=$arm64Hash" >> $env:GITHUB_ENV
- name: Update version and checksums
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
# Update version in nuspec
$nuspec = 'packaging/chocolatey/confluence-cli.nuspec'
(Get-Content $nuspec) -replace '<version>0.0.0</version>', "<version>$version</version>" | Set-Content $nuspec
Write-Host "Updated nuspec to version $version"
# Inject checksums into install script
$script = 'packaging/chocolatey/tools/chocolateyInstall.ps1'
$content = Get-Content $script -Raw
$content = $content -replace 'CHECKSUM_AMD64_PLACEHOLDER', $env:X64_HASH
$content = $content -replace 'CHECKSUM_ARM64_PLACEHOLDER', $env:ARM64_HASH
Set-Content $script $content
Write-Host "Injected checksums into install script"
- name: Pack Chocolatey package
shell: pwsh
run: |
cd packaging/chocolatey
choco pack
Get-ChildItem *.nupkg
- name: Push to Chocolatey
shell: pwsh
run: |
cd packaging/chocolatey
choco push (Get-ChildItem *.nupkg).Name --source https://push.chocolatey.org/ --key ${{ secrets.CHOCOLATEY_API_KEY }}
winget:
needs: goreleaser
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install wingetcreate
shell: pwsh
run: |
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
- name: Check if manifest exists in winget-pkgs
id: check-manifest
shell: pwsh
run: |
$response = Invoke-WebRequest -Uri "https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/o/OpenCLICollective/cfl" -Method Head -SkipHttpErrorCheck
if ($response.StatusCode -eq 200) {
Write-Host "Manifest exists - will use wingetcreate update"
echo "exists=true" >> $env:GITHUB_OUTPUT
} else {
Write-Host "Manifest does not exist - will use wingetcreate new"
echo "exists=false" >> $env:GITHUB_OUTPUT
}
- name: Get checksums from release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
gh release download "${{ github.ref_name }}" --repo open-cli-collective/confluence-cli --pattern "checksums.txt" --dir .
$checksums = Get-Content checksums.txt
$x64Hash = ($checksums | Select-String "windows_amd64.zip").Line.Split()[0]
$arm64Hash = ($checksums | Select-String "windows_arm64.zip").Line.Split()[0]
Write-Host "x64 SHA256: $x64Hash"
Write-Host "arm64 SHA256: $arm64Hash"
echo "X64_HASH=$x64Hash" >> $env:GITHUB_ENV
echo "ARM64_HASH=$arm64Hash" >> $env:GITHUB_ENV
- name: Update manifest (existing package)
if: steps.check-manifest.outputs.exists == 'true'
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
$x64 = "https://github.com/open-cli-collective/confluence-cli/releases/download/${{ github.ref_name }}/cfl_${version}_windows_amd64.zip"
$arm64 = "https://github.com/open-cli-collective/confluence-cli/releases/download/${{ github.ref_name }}/cfl_${version}_windows_arm64.zip"
Write-Host "Updating existing manifest to version $version"
./wingetcreate.exe update OpenCLICollective.cfl --version $version --urls $x64 $arm64 --submit --token ${{ secrets.WINGET_GITHUB_TOKEN }}
- name: Create manifest (new package)
if: steps.check-manifest.outputs.exists == 'false'
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart('v')
$manifestDir = "manifests"
New-Item -ItemType Directory -Path $manifestDir -Force | Out-Null
# Update version manifest
$versionManifest = Get-Content "packaging/winget/OpenCLICollective.cfl.yaml" -Raw
$versionManifest = $versionManifest -replace "0\.0\.0", $version
Set-Content "$manifestDir/OpenCLICollective.cfl.yaml" $versionManifest
# Update locale manifest
$localeManifest = Get-Content "packaging/winget/OpenCLICollective.cfl.locale.en-US.yaml" -Raw
$localeManifest = $localeManifest -replace "0\.0\.0", $version
Set-Content "$manifestDir/OpenCLICollective.cfl.locale.en-US.yaml" $localeManifest
# Update installer manifest with version and real checksums
$installerManifest = Get-Content "packaging/winget/OpenCLICollective.cfl.installer.yaml" -Raw
$installerManifest = $installerManifest -replace "0\.0\.0", $version
# Replace checksums one at a time using .NET regex (PowerShell -replace doesn't support count)
$regex = [regex]"0{64}"
$installerManifest = $regex.Replace($installerManifest, $env:X64_HASH, 1)
$installerManifest = $regex.Replace($installerManifest, $env:ARM64_HASH, 1)
Set-Content "$manifestDir/OpenCLICollective.cfl.installer.yaml" $installerManifest
Write-Host "Generated manifests:"
Get-ChildItem $manifestDir | ForEach-Object { Write-Host " $_" }
Write-Host "`nValidating manifests..."
winget validate --manifest $manifestDir
if ($LASTEXITCODE -ne 0) {
Write-Error "Manifest validation failed"
exit 1
}
Write-Host "Validation passed!"
Write-Host "`nSubmitting new package to Winget..."
./wingetcreate.exe submit --token ${{ secrets.WINGET_GITHUB_TOKEN }} $manifestDir
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: 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
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": "cfl",
"version": "${{ github.ref_name }}",
"repo": "open-cli-collective/confluence-cli"
}