Skip to content

Commit 06c569e

Browse files
committed
Automate scoop
1 parent 42aca5f commit 06c569e

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,35 @@ jobs:
186186
asset_path: ./${{ steps.set_vars.outputs.BIN_RELEASE_VERSIONED }}
187187
asset_name: ${{ steps.set_vars.outputs.BIN_RELEASE_VERSIONED }}
188188
asset_content_type: application/octet-stream
189+
190+
update_scoop_manifest:
191+
needs: [upload_assets]
192+
runs-on: ubuntu-latest
193+
steps:
194+
- name: Checkout Code
195+
uses: actions/checkout@v4
196+
with:
197+
ssh-key: ${{ secrets.DEPLOY_KEY }}
198+
fetch-depth: 0
199+
200+
- name: Switch to Main Branch
201+
run: |
202+
git checkout main
203+
204+
- name: Install Dependencies
205+
run: sudo apt-get install -y curl
206+
207+
- name: Run Script to Generate Scoop Manifest
208+
run: |
209+
chmod +x scoop/generate-scoop-manifest.sh
210+
scoop/generate-scoop-manifest.sh ${{ github.ref_name }}
211+
212+
- name: Commit and Push Updated Scoop Manifest
213+
env:
214+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
215+
run: |
216+
git config user.name "GitHub Actions"
217+
git config user.email "[email protected]"
218+
git add scoop/bi.json
219+
git commit -m "chore(scoop): Update Scoop manifest for version ${{ github.ref_name }}"
220+
git push origin main

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bi"
3-
version = "0.0.26"
3+
version = "0.0.27"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

scoop/generate-scoop-manifest.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Variables
4+
VERSION="$1"
5+
VERSION="${VERSION#v}"
6+
OUTPUT_DIR="./scoop"
7+
REPO_URL="https://github.com/gobeyondidentity/bi-cli/releases/download/v$VERSION"
8+
9+
# Function to fetch SHA-256 hash of a file from GitHub
10+
fetch_sha256() {
11+
local url="$1"
12+
curl -L "$url" | sha256sum | awk '{print $1}'
13+
}
14+
15+
# Generate the Scoop manifest
16+
generate_scoop_manifest() {
17+
cat > $OUTPUT_DIR/bi.json <<EOM
18+
{
19+
"version": "$VERSION",
20+
"description": "A CLI tool for Beyond Identity",
21+
"homepage": "https://github.com/gobeyondidentity/bi-cli",
22+
"license": "Apache-2.0",
23+
"architecture": {
24+
"64bit": {
25+
"url": "$REPO_URL/bi_v${VERSION}_Windows_x86_64.zip",
26+
"hash": "$(fetch_sha256 "$REPO_URL"/bi_v"${VERSION}"_Windows_x86_64.zip)"
27+
},
28+
"arm64": {
29+
"url": "$REPO_URL/bi_v${VERSION}_Windows_arm64.zip",
30+
"hash": "$(fetch_sha256 "$REPO_URL"/bi_v"${VERSION}"_Windows_arm64.zip)"
31+
}
32+
},
33+
"bin": "bi.exe",
34+
"checkver": {
35+
"url": "https://github.com/gobeyondidentity/bi-cli/releases",
36+
"re": "/releases/tag/v([\\\\d.]+)"
37+
},
38+
"autoupdate": {
39+
"architecture": {
40+
"64bit": {
41+
"url": "https://github.com/gobeyondidentity/bi-cli/releases/download/v\$version/bi_v\$version_Windows_x86_64.zip"
42+
},
43+
"arm64": {
44+
"url": "https://github.com/gobeyondidentity/bi-cli/releases/download/v\$version/bi_v\$version_Windows_arm64.zip"
45+
}
46+
}
47+
}
48+
}
49+
EOM
50+
}
51+
52+
# Run the function to generate the manifest
53+
generate_scoop_manifest
54+
55+
echo "Scoop manifest generated at $OUTPUT_DIR/bi.json"

0 commit comments

Comments
 (0)