-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (144 loc) · 5.34 KB
/
update-package-managers.yml
File metadata and controls
158 lines (144 loc) · 5.34 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
name: Update Package Managers
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.1.9)'
required: true
permissions:
contents: read
jobs:
update-homebrew:
name: Update Homebrew Formula
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
TAG="${{ github.event.inputs.tag }}"
else
TAG="${{ github.event.release.tag_name }}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download source tarball and compute hash
id: hash
run: |
TAG="${{ steps.release.outputs.tag }}"
URL="https://github.com/writerslogic/witnessd-cli/archive/refs/tags/${TAG}.tar.gz"
curl -sSfL -o source.tar.gz "$URL"
SHA256=$(sha256sum source.tar.gz | awk '{print $1}')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
- name: Checkout homebrew-tap
uses: actions/checkout@v4
with:
repository: writerslogic/homebrew-tap
token: ${{ secrets.TAP_GITHUB_TOKEN }}
path: homebrew-tap
- name: Update formula
run: |
cd homebrew-tap
TAG="${{ steps.release.outputs.tag }}"
SHA256="${{ steps.hash.outputs.sha256 }}"
URL="${{ steps.hash.outputs.url }}"
sed -i "s|url \".*\"|url \"${URL}\"|" Formula/witnessd.rb
sed -i "s|sha256 \".*\"|sha256 \"${SHA256}\"|" Formula/witnessd.rb
- name: Commit and push
run: |
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/witnessd.rb
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "witnessd ${{ steps.release.outputs.tag }}"
git push
fi
update-scoop:
name: Update Scoop Manifest
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
TAG="${{ github.event.inputs.tag }}"
else
TAG="${{ github.event.release.tag_name }}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download Windows artifact and compute hash
id: hash
run: |
TAG="${{ steps.release.outputs.tag }}"
URL="https://github.com/writerslogic/witnessd-cli/releases/download/${TAG}/witnessd_${TAG}_x86_64-pc-windows-msvc.zip"
curl -sSfL -o windows.zip "$URL"
SHA256=$(sha256sum windows.zip | awk '{print $1}')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
- name: Checkout scoop-bucket
uses: actions/checkout@v4
with:
repository: writerslogic/scoop-bucket
token: ${{ secrets.TAP_GITHUB_TOKEN }}
path: scoop-bucket
- name: Update manifest
run: |
cd scoop-bucket
TAG="${{ steps.release.outputs.tag }}"
VERSION="${{ steps.release.outputs.version }}"
SHA256="${{ steps.hash.outputs.sha256 }}"
URL="${{ steps.hash.outputs.url }}"
cat > witnessd.json << MANIFEST
{
"\$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
"version": "${VERSION}",
"description": "Cryptographic authorship witnessing for writers and creators",
"homepage": "https://writerslogic.com",
"license": "GPL-3.0-only",
"architecture": {
"64bit": {
"url": "${URL}",
"hash": "${SHA256}"
}
},
"bin": [
"witnessd-cli.exe",
["witnessd-cli.exe", "witnessd"]
],
"checkver": {
"github": "https://github.com/writerslogic/witnessd-cli"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/writerslogic/witnessd-cli/releases/download/v\$version/witnessd_v\$version_x86_64-pc-windows-msvc.zip",
"hash": {
"url": "https://github.com/writerslogic/witnessd-cli/releases/download/v\$version/checksums.txt",
"regex": "([a-f0-9]{64})\\s+witnessd_v\$version_x86_64-pc-windows-msvc.zip"
}
}
}
}
}
MANIFEST
- name: Commit and push
run: |
cd scoop-bucket
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add witnessd.json
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "witnessd ${{ steps.release.outputs.tag }}"
git push
fi