Release/v3.0.1 (#20) #60
Workflow file for this run
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]*.[0-9]*.[0-9]*'# Trigger only on version tags like v1.2.3 | |
| jobs: | |
| # --- JOB 1: BUILD --- | |
| # This job runs in a matrix to build for all target platforms in parallel. | |
| build: | |
| name: Build for ${{ matrix.target }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: linux-x64 | |
| asset_name: OpenSSH-GUI-linux-x64 | |
| asset_extension: '' | |
| - target: win-x64 | |
| asset_name: OpenSSH-GUI-win-x64 | |
| asset_extension: '.exe' | |
| - target: osx-x64 | |
| asset_name: OpenSSH-GUI-osx-x64 | |
| asset_extension: '' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - 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- | |
| # Restore, build, and publish the application for the specific target | |
| - name: Publish application | |
| run: | | |
| dotnet publish OpenSSH_GUI/OpenSSH_GUI.csproj \ | |
| --configuration Release \ | |
| --runtime ${{ matrix.target }} \ | |
| --output "./publish" \ | |
| -p:PublishSingleFile=true \ | |
| -p:PublishReadyToRun=true \ | |
| -p:IncludeNativeLibrariesForSelfExtract=true \ | |
| -p:Version="${GITHUB_REF_NAME#v}" | |
| # Rename the output file to the desired asset name | |
| - 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: | | |
| # Download appimagetool | |
| wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool | |
| chmod +x appimagetool | |
| # Create AppDir structure | |
| 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 | |
| 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 | |
| # Build AppImage | |
| ARCH=x86_64 ./appimagetool --appimage-extract-and-run AppDir OpenSSH-GUI-x86_64.AppImage | |
| - name: Upload AppImage artifact | |
| if: matrix.target == 'linux-x64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: OpenSSH-GUI-x86_64.AppImage | |
| path: OpenSSH-GUI-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: RELEASE --- | |
| # This job runs only ONCE after all build jobs have successfully completed. | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| # The 'needs' keyword ensures that this job waits for the 'build' job to finish | |
| needs: build | |
| permissions: | |
| contents: write # Required to create a release and upload assets | |
| # Ensure this job only runs for tag pushes, not for manual dispatches that should only build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Download all artifacts (from the matrix builds) into a single directory | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts | |
| - name: Prepare extra assets | |
| run: | | |
| cp OpenSSH_GUI/Assets/appicon.png artifacts/ | |
| cp LICENSE artifacts/ | |
| # Create a single release and upload all files from the 'artifacts' directory | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| # The release will be created from the pushed tag | |
| tag_name: ${{ github.ref_name }} | |
| # All files downloaded into the 'artifacts' directory will be uploaded | |
| files: "artifacts/**/*" | |
| # Automatically generate the release body from commits since the last tag | |
| generate_release_notes: true | |
| deploy-aur: | |
| name: Update AUR Packages | |
| runs-on: ubuntu-latest | |
| needs: release | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| 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-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-bin | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| SHA_BIN=$(sha256sum OpenSSH-GUI-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-bin/PKGBUILD | |
| sed -i "s/sha256sums=.*/sha256sums=('$SHA_BIN' '$SHA_ICON' '$SHA_DESKTOP' '$SHA_LICENSE')/" openssh-gui-bin/PKGBUILD | |
| # Also update openssh-gui-git pkgver for consistency | |
| sed -i "s/^pkgver=.*/pkgver=$VERSION/" openssh-gui-git/PKGBUILD | |
| - name: Update AUR (openssh-gui-bin) | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: openssh-gui-bin | |
| pkgbuild: ./openssh-gui-bin/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: "Update to ${{ github.ref_name }}" | |
| - name: Update AUR (openssh-gui-git) | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: openssh-gui-git | |
| pkgbuild: ./openssh-gui-git/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: "Update to ${{ github.ref_name }}" |