1 name: Scoop Release
2
3 # Dispatched by release-github.yml once the release and its checksums exist.
4 on:
5 workflow_dispatch:
6 inputs:
7 tag:
8 description: "Release tag (e.g. v1.5.2)"
9 required: true
10
11 permissions:
12 contents: read
13
14 env:
15 REPO: getsigit/sigit
16
17 jobs:
18 update-scoop-bucket:
19 name: Update Scoop bucket
20 runs-on: ubuntu-latest
21
22 steps:
23 - name: Resolve tag and version
24 id: release
25 shell: bash
26 run: |
27 TAG="${{ github.event.inputs.tag }}"
28 VERSION="${TAG#v}"
29
30 echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
31 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
32
33 - name: Read SHA256 checksums from release
34 id: sha
35 env:
36 GH_TOKEN: ${{ github.token }}
37 shell: bash
38 run: |
39 mkdir -p artifacts
40
41 gh release download "${{ steps.release.outputs.tag }}" \
42 --repo "${{ env.REPO }}" \
43 --pattern "sigit-win-*.exe.sha256" \
44 --dir artifacts/
45
46 AMD64_SHA=$(cat artifacts/sigit-win-amd64.exe.sha256)
47 ARM64_SHA=$(cat artifacts/sigit-win-arm64.exe.sha256)
48
49 echo "amd64=${AMD64_SHA}" >> "$GITHUB_OUTPUT"
50 echo "arm64=${ARM64_SHA}" >> "$GITHUB_OUTPUT"
51
52 echo "AMD64 SHA256: ${AMD64_SHA}"
53 echo "ARM64 SHA256: ${ARM64_SHA}"
54
55 - name: Checkout Scoop bucket
56 uses: actions/checkout@v6
57 with:
58 repository: getsigit/scoop-bucket
59 token: ${{ secrets.SCOOP_BUCKET_TOKEN }}
60 path: scoop-bucket
61
62 - name: Generate manifest
63 shell: bash
64 run: |
65 VERSION="${{ steps.release.outputs.version }}"
66 TAG="${{ steps.release.outputs.tag }}"
67 AMD64_SHA="${{ steps.sha.outputs.amd64 }}"
68 ARM64_SHA="${{ steps.sha.outputs.arm64 }}"
69
70 mkdir -p scoop-bucket/bucket
71
72 # The `#/sigit.exe` URL fragment is Scoop's rename-on-download
73 # syntax: the release asset is sigit-win-amd64.exe, but the shim has
74 # to end up as sigit.exe for `sigit` to work on PATH.
75 cat > scoop-bucket/bucket/sigit.json <<MANIFEST
76 {
77 "version": "${VERSION}",
78 "description": "siGit Code, an AI coding agent that runs on your machine.",
79 "homepage": "https://sigit.si",
80 "license": "Apache-2.0",
81 "architecture": {
82 "64bit": {
83 "url": "https://github.com/${REPO}/releases/download/${TAG}/sigit-win-amd64.exe#/sigit.exe",
84 "hash": "${AMD64_SHA}"
85 },
86 "arm64": {
87 "url": "https://github.com/${REPO}/releases/download/${TAG}/sigit-win-arm64.exe#/sigit.exe",
88 "hash": "${ARM64_SHA}"
89 }
90 },
91 "bin": "sigit.exe",
92 "checkver": {
93 "github": "https://github.com/${REPO}"
94 },
95 "autoupdate": {
96 "architecture": {
97 "64bit": {
98 "url": "https://github.com/${REPO}/releases/download/v\$version/sigit-win-amd64.exe#/sigit.exe"
99 },
100 "arm64": {
101 "url": "https://github.com/${REPO}/releases/download/v\$version/sigit-win-arm64.exe#/sigit.exe"
102 }
103 },
104 "hash": {
105 "url": "\$url.sha256"
106 }
107 }
108 }
109 MANIFEST
110
111 echo "Generated manifest:"
112 cat scoop-bucket/bucket/sigit.json
113
114 - name: Validate manifest JSON
115 shell: bash
116 run: |
117 if ! jq empty scoop-bucket/bucket/sigit.json; then
118 echo "::error::Generated Scoop manifest is not valid JSON" >&2
119 exit 1
120 fi
121
122 for field in version bin architecture; do
123 if [ "$(jq -r "has(\"${field}\")" scoop-bucket/bucket/sigit.json)" != "true" ]; then
124 echo "::error::Scoop manifest is missing the '${field}' field" >&2
125 exit 1
126 fi
127 done
128
129 - name: Commit and push
130 shell: bash
131 run: |
132 VERSION="${{ steps.release.outputs.version }}"
133
134 cd scoop-bucket
135 git config user.name "github-actions[bot]"
136 git config user.email "github-actions[bot]@users.noreply.github.com"
137 git add bucket/sigit.json
138 git diff --cached --quiet && echo "No changes to commit" && exit 0
139 git commit -m "Update sigit to ${VERSION}"
140 git push