-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (131 loc) · 5.42 KB
/
Copy pathsubmit-packages.yml
File metadata and controls
143 lines (131 loc) · 5.42 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
name: Submit to Package Managers
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to submit (without leading v)"
required: true
managers:
description: "Comma-separated: homebrew,scoop,winget,aur,nix — or all"
required: false
default: "all"
dry_run:
description: "Generate manifests but do not push anywhere"
type: boolean
default: true
permissions:
contents: read
jobs:
generate:
name: Generate manifests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: Determine version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
V="${{ github.event.inputs.version }}"
else
V="${GITHUB_REF#refs/tags/}"
fi
echo "version=${V#v}" >> "$GITHUB_OUTPUT"
# Manifests are derived from the release's own SHA256SUMS.txt, so this
# step fails loudly if the release is incomplete rather than publishing a
# manifest that points at a missing or mismatched binary.
- name: Generate
run: |
node tools/release/package-managers.mjs \
--version "${{ steps.version.outputs.version }}" \
--manager "${{ github.event.inputs.managers || 'all' }}" \
--out dist/packaging
- name: Show what was generated
run: find dist/packaging -type f -print -exec echo '---' \; -exec cat {} \;
- uses: actions/upload-artifact@v5
with:
name: package-manifests-${{ steps.version.outputs.version }}
path: dist/packaging
submit:
name: Submit
needs: generate
runs-on: ubuntu-latest
# A published release submits. A manual run is a dry run unless explicitly
# told otherwise, because publishing to a tap or the AUR is immediately
# visible to anyone who pulls.
if: github.event_name == 'release' || github.event.inputs.dry_run == 'false'
env:
# Per-repository deploy keys rather than one personal access token: each
# is write-scoped to a single repo and revocable on its own, so a leak
# cannot reach anything else in the org.
TAP_DEPLOY_KEY: ${{ secrets.TAP_DEPLOY_KEY }}
BUCKET_DEPLOY_KEY: ${{ secrets.BUCKET_DEPLOY_KEY }}
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v5
with:
pattern: package-manifests-*
merge-multiple: true
path: dist/packaging
- name: Homebrew tap
if: env.TAP_DEPLOY_KEY != ''
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s\n' "$TAP_DEPLOY_KEY" > ~/.ssh/tap && chmod 600 ~/.ssh/tap
ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
GIT_SSH_COMMAND="ssh -i ~/.ssh/tap -o IdentitiesOnly=yes" \
git clone git@github.com:profullstack/homebrew-tap.git tap
mkdir -p tap/Casks
cp dist/packaging/homebrew/nightcell7.rb tap/Casks/
cd tap
git config user.name "nightcell7-release"
git config user.email "support@nightcell7.com"
git add Casks/nightcell7.rb
git diff --staged --quiet || git commit -m "nightcell7: update cask"
GIT_SSH_COMMAND="ssh -i ~/.ssh/tap -o IdentitiesOnly=yes" git push
- name: Scoop bucket
if: env.BUCKET_DEPLOY_KEY != ''
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s\n' "$BUCKET_DEPLOY_KEY" > ~/.ssh/bucket && chmod 600 ~/.ssh/bucket
ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
GIT_SSH_COMMAND="ssh -i ~/.ssh/bucket -o IdentitiesOnly=yes" \
git clone git@github.com:profullstack/scoop-bucket.git bucket
mkdir -p bucket/bucket
cp dist/packaging/scoop/nightcell7.json bucket/bucket/
cd bucket
git config user.name "nightcell7-release"
git config user.email "support@nightcell7.com"
git add bucket/nightcell7.json
git diff --staged --quiet || git commit -m "nightcell7: update manifest"
GIT_SSH_COMMAND="ssh -i ~/.ssh/bucket -o IdentitiesOnly=yes" git push
- name: AUR
if: env.AUR_SSH_KEY != ''
run: |
mkdir -p ~/.ssh
echo "$AUR_SSH_KEY" | base64 -d > ~/.ssh/aur
chmod 600 ~/.ssh/aur
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
printf 'Host aur.archlinux.org\n IdentityFile ~/.ssh/aur\n User aur\n' >> ~/.ssh/config
git clone ssh://aur@aur.archlinux.org/nightcell7-bin.git aur
cp dist/packaging/aur/PKGBUILD dist/packaging/aur/.SRCINFO aur/
cd aur
git config user.name "nightcell7-release"
git config user.email "support@nightcell7.com"
git add PKGBUILD .SRCINFO
git diff --staged --quiet || git commit -m "nightcell7-bin: update"
git push
# winget requires a PR to microsoft/winget-pkgs, which is a review
# process rather than a push. The manifests are attached to the run for a
# human to submit with wingetcreate.
- name: WinGet note
run: |
echo "WinGet manifests are in the run artifacts."
echo "Submit with: wingetcreate submit dist/packaging/winget"