-
-
Notifications
You must be signed in to change notification settings - Fork 4
241 lines (202 loc) · 8.81 KB
/
staging.yml
File metadata and controls
241 lines (202 loc) · 8.81 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Staging / Nightly Build
on:
push:
branches:
- development
env:
BUILD_CONFIGURATION: Release
permissions:
contents: write
jobs:
# --- JOB 1: BUILD ---
build:
name: Build for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: linux-x64
asset_name: OpenSSH-GUI-nightly-linux-x64
asset_extension: ""
- target: win-x64
asset_name: OpenSSH-GUI-nightly-win-x64
asset_extension: ".exe"
- target: osx-x64
asset_name: OpenSSH-GUI-nightly-osx-x64
asset_extension: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine .NET version from project
id: dotnet-version
run: |
TFM=$(grep -oPm1 '(?<=<TargetFramework>net)[0-9.]+' Directory.Build.props)
echo "version=${TFM}.x" >> "$GITHUB_OUTPUT"
echo "Detected TargetFramework: net${TFM} → installing SDK ${TFM}.x"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ steps.dotnet-version.outputs.version }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-dotnet-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-dotnet-
- name: Resolve git metadata
id: meta
run: |
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y-%m-%d)
BASE_VERSION=$(grep -oPm1 '(?<=<BaseVersion>)[^<]+' Directory.Build.props)
VERSION="${BASE_VERSION}+${HASH}"
echo "GIT_HASH=$HASH" >> "$GITHUB_ENV"
echo "BUILD_DATE=$DATE" >> "$GITHUB_ENV"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "BASE_VERSION=$BASE_VERSION" >> "$GITHUB_ENV"
- name: Publish application
run: |
dotnet publish OpenSSH_GUI/OpenSSH_GUI.csproj \
--configuration ${{ env.BUILD_CONFIGURATION }} \
--runtime ${{ matrix.target }} \
--output "./publish" \
-p:PublishSingleFile=true \
-p:PublishReadyToRun=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:Version="${{ env.VERSION }}"
- name: Rename artifact
run: mv ./publish/OpenSSH_GUI${{ matrix.asset_extension }} ./publish/${{ matrix.asset_name }}${{ matrix.asset_extension }}
# --- AppImage (Linux only) ---
- name: Build AppImage
if: matrix.target == 'linux-x64'
run: |
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
chmod +x appimagetool
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/metainfo
cp ./publish/${{ matrix.asset_name }} AppDir/usr/bin/openssh-gui
chmod +x AppDir/usr/bin/openssh-gui
cp OpenSSH_GUI/Assets/appicon.png AppDir/usr/share/icons/hicolor/256x256/apps/openssh-gui.png
cp OpenSSH_GUI/Assets/appicon.png AppDir/openssh-gui.png
APPSTREAM_VERSION="${VERSION//+/~}"
cp appimage/io.github.frequency403.openssh_gui.metainfo.xml AppDir/usr/share/metainfo/io.github.frequency403.openssh_gui.metainfo.xml
sed -i "s|<release version=\"0.0.0\" date=\"1970-01-01\"/>|<release version=\"${APPSTREAM_VERSION}\" date=\"$(date +%Y-%m-%d)\"/>|" \
AppDir/usr/share/metainfo/io.github.frequency403.openssh_gui.metainfo.xml
appstreamcli make-desktop-file \
AppDir/usr/share/metainfo/io.github.frequency403.openssh_gui.metainfo.xml \
AppDir/usr/share/applications/io.github.frequency403.openssh_gui.desktop
cp AppDir/usr/share/applications/io.github.frequency403.openssh_gui.desktop \
AppDir/io.github.frequency403.openssh_gui.desktop
cp appimage/AppRun AppDir/AppRun
chmod +x AppDir/AppRun
ARCH=x86_64 ./appimagetool --appimage-extract-and-run AppDir OpenSSH-GUI-nightly-x86_64.AppImage
- name: Upload AppImage artifact
if: matrix.target == 'linux-x64'
uses: actions/upload-artifact@v4
with:
name: OpenSSH-GUI-nightly-x86_64.AppImage
path: OpenSSH-GUI-nightly-x86_64.AppImage
- name: Upload generated desktop file
if: matrix.target == 'linux-x64'
uses: actions/upload-artifact@v4
with:
name: io.github.frequency403.openssh_gui.desktop
path: AppDir/usr/share/applications/io.github.frequency403.openssh_gui.desktop
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}${{ matrix.asset_extension }}
path: ./publish/${{ matrix.asset_name }}${{ matrix.asset_extension }}
# --- JOB 2: NIGHTLY RELEASE ---
nightly-release:
name: Create Nightly Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve git metadata
run: |
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y-%m-%d)
BASE_VERSION=$(grep -oPm1 '(?<=<BaseVersion>)[^<]+' Directory.Build.props)
echo "GIT_HASH=$HASH" >> "$GITHUB_ENV"
echo "BUILD_DATE=$DATE" >> "$GITHUB_ENV"
echo "VERSION=${BASE_VERSION}+${HASH}" >> "$GITHUB_ENV"
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Update nightly release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NOTES="**Branch:** \`development\`
**Commit:** \`${{ env.GIT_HASH }}\`
**Built:** ${{ env.BUILD_DATE }}
> Automated nightly build — not intended for production use."
if gh release view nightly &>/dev/null; then
gh release edit nightly \
--title "Nightly (${{ env.BUILD_DATE }}) — ${{ env.VERSION }}" \
--notes "$NOTES" \
--prerelease
gh release view nightly --json assets --jq '.assets[].name' \
| xargs -r -I{} gh release delete-asset nightly {} --yes
find artifacts -type f | xargs gh release upload nightly
else
find artifacts -type f | xargs gh release create nightly \
--title "Nightly (${{ env.BUILD_DATE }}) — ${{ env.VERSION }}" \
--notes "$NOTES" \
--prerelease
fi
# --- JOB 3: AUR NIGHTLY ---
deploy-aur-nightly:
name: Update AUR Nightly Package
runs-on: ubuntu-latest
needs: nightly-release
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: OpenSSH-GUI-nightly-linux-x64
path: ./
- name: Download generated desktop file
uses: actions/download-artifact@v4
with:
name: io.github.frequency403.openssh_gui.desktop
path: ./
- name: Update PKGBUILD for openssh-gui-nightly
run: |
HASH=$(git rev-parse --short HEAD)
DATE=$(date +%Y%m%d)
BASE_VERSION=$(grep -oPm1 '(?<=<BaseVersion>)[^<]+' Directory.Build.props)
VERSION="${BASE_VERSION}.${DATE}.${HASH}"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
SHA_BIN=$(sha256sum OpenSSH-GUI-nightly-linux-x64 | cut -d' ' -f1)
SHA_ICON=$(sha256sum OpenSSH_GUI/Assets/appicon.png | cut -d' ' -f1)
SHA_DESKTOP=$(sha256sum io.github.frequency403.openssh_gui.desktop | cut -d' ' -f1)
SHA_LICENSE=$(sha256sum LICENSE | cut -d' ' -f1)
sed -i "s/^pkgver=.*/pkgver=$VERSION/" openssh-gui-nightly/PKGBUILD
sed -i "s/sha256sums=.*/sha256sums=('$SHA_BIN' '$SHA_ICON' '$SHA_DESKTOP' '$SHA_LICENSE')/" openssh-gui-nightly/PKGBUILD
- name: Update AUR (openssh-gui-nightly)
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: openssh-gui-nightly
pkgbuild: ./openssh-gui-nightly/PKGBUILD
commit_username: ${{ github.repository_owner }}
commit_email: ${{ github.repository_owner }}@users.noreply.github.com
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Nightly update ${{ env.VERSION }}"