-
-
Notifications
You must be signed in to change notification settings - Fork 4
179 lines (153 loc) · 5.23 KB
/
Copy pathbuild.yml
File metadata and controls
179 lines (153 loc) · 5.23 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
name: Build and Release
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
branches:
- master
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false # Never cancel an in-flight release
jobs:
test:
name: Run Tests
uses: ./.github/workflows/test.yml
prepare:
name: Prepare Metadata
runs-on: ubuntu-latest
timeout-minutes: 5
needs: test
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: '1'
ref: ${{ github.ref }}
- name: Determine Version
id: version
uses: ./.github/actions/determine-version
build:
needs: [test, prepare]
uses: ./.github/workflows/build-and-package.yml
with:
version: ${{ needs.prepare.outputs.version }}
asset_name_prefix: OpenSSH-GUI
create_installer:
name: Create Windows Installer
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [test, prepare, build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
fetch-depth: '1'
ref: ${{ github.ref }}
- name: Download Windows binary
uses: actions/download-artifact@v8
with:
name: OpenSSH-GUI-win-x64.exe
path: ./publish
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
nsis \
librsvg2-bin \
imagemagick
- name: Convert SVG to multi-resolution ICO
run: |
set -euo pipefail
for SIZE in 16 32 48 64 128 256; do
rsvg-convert -w "$SIZE" -h "$SIZE" \
images/openssh-gui.svg -o "/tmp/icon-${SIZE}.png"
done
convert \
/tmp/icon-16.png /tmp/icon-32.png /tmp/icon-48.png \
/tmp/icon-64.png /tmp/icon-128.png /tmp/icon-256.png \
installer-icon.ico
- name: Substitute installer variables
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: |
sed \
-e "s|@@VERSION@@|${VERSION}|g" \
-e "s|@@SOURCE_EXE@@|publish/OpenSSH-GUI-win-x64.exe|g" \
installer/OpenSSH-GUI.nsi > installer.nsi
- name: Build installer
run: makensis installer.nsi
- name: Upload installer artifact
uses: actions/upload-artifact@v7
with:
name: OpenSSH-GUI-${{ needs.prepare.outputs.version }}-Setup
path: OpenSSH-GUI-${{ needs.prepare.outputs.version }}-Setup.exe
if-no-files-found: error
release:
name: Create GitHub Release
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [test, prepare, build, create_installer]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Download all build artifacts
uses: actions/download-artifact@v8
with:
path: artifacts/
- name: Prepare and validate release assets
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: |
set -euo pipefail
rm -rf release-assets
mkdir -p release-assets
# Copy all artifacts, hard-fail on name collision
find artifacts -type f | while read -r FILE; do
DEST="release-assets/$(basename "$FILE")"
if [[ -f "$DEST" ]]; then
echo "::error::Artifact name collision detected: $(basename "$FILE")"
exit 1
fi
cp "$FILE" "$DEST"
done
# Raw win-x64 binary is an intermediate artifact only —
# the installer replaces it as the Windows distribution unit
rm -f "release-assets/OpenSSH-GUI-win-x64.exe"
cp LICENSE release-assets/LICENSE
# Assert all expected files are present before creating the release.
# appicon.png and .desktop are required by openssh-gui-bin PKGBUILD source URLs.
for EXPECTED in \
"OpenSSH-GUI-linux-x64" \
"OpenSSH-GUI-${VERSION}-Setup.exe" \
"OpenSSH-GUI-osx-x64" \
"OpenSSH-GUI-x86_64.AppImage" \
"appicon.png" \
"io.github.frequency403.openssh_gui.desktop"
do
if [[ ! -f "release-assets/$EXPECTED" ]]; then
echo "::error::Expected release asset missing: $EXPECTED"
exit 1
fi
done
echo "Release assets:"
ls -lah release-assets/
- name: Publish GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.prepare.outputs.tag }}
files: release-assets/*
generate_release_notes: true
token: ${{ secrets.PAT_TOKEN }}
- name: Trigger deployment
uses: peter-evans/repository-dispatch@v4
with:
event-type: deploy
token: ${{ secrets.PAT_TOKEN }}
client-payload: '{"tag": "${{ needs.prepare.outputs.tag }}", "version": "${{ needs.prepare.outputs.version }}"}'