This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 appimage/io.github.OWNER.openssh-gui.appdata.xml AppDir/usr/share/metainfo/io.github.OWNER.openssh-gui.appdata.xml | |
| 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 | |
| cp openssh-gui.desktop AppDir/openssh-gui.desktop | |
| cp openssh-gui.desktop AppDir/usr/share/applications/openssh-gui.desktop | |
| cp appimage/AppRun AppDir/AppRun | |
| APPSTREAM_VERSION="${VERSION//+/~}" | |
| 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.OWNER.openssh-gui.appdata.xml | |
| 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 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: 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 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 }}" |