| 1 | name: Build Release Packages |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: [published] |
| 6 | workflow_dispatch: |
| 7 | inputs: |
| 8 | version: |
| 9 | description: 'Version to build (e.g., 1.0-rc1)' |
| 10 | required: true |
| 11 | default: 'test' |
| 12 | |
| 13 | env: |
| 14 | APP_NAME: alsa-scarlett-gui |
| 15 | APP_VERSION: ${{ github.event.release.tag_name || github.event.inputs.version }} |
| 16 | |
| 17 | jobs: |
| 18 | build-rpm: |
| 19 | runs-on: ubuntu-latest |
| 20 | container: fedora:latest |
| 21 | steps: |
| 22 | - name: Install git for checkout |
| 23 | run: dnf install -y git |
| 24 | |
| 25 | - uses: actions/checkout@v5 |
| 26 | with: |
| 27 | fetch-depth: 0 |
| 28 | |
| 29 | - name: Trust workspace |
| 30 | run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 31 | |
| 32 | - name: Install build dependencies |
| 33 | run: > |
| 34 | dnf install -y rpm-build make gcc |
| 35 | gtk4-devel alsa-lib-devel openssl-devel |
| 36 | |
| 37 | - name: Build RPM |
| 38 | run: | |
| 39 | VERSION=$(echo "${{ env.APP_VERSION }}" | sed 's/-rc/~rc/g') |
| 40 | make rpm VERSION="$VERSION" |
| 41 | |
| 42 | - name: Find and rename RPM |
| 43 | id: find-rpm |
| 44 | run: | |
| 45 | src=$(find ~/rpmbuild/RPMS -name '*.rpm' -not -name '*debug*' | head -1) |
| 46 | dst=${{ env.APP_NAME }}-${{ env.APP_VERSION }}.x86_64.rpm |
| 47 | cp "$src" "$dst" |
| 48 | echo "rpm_path=$dst" >> $GITHUB_OUTPUT |
| 49 | |
| 50 | - name: Upload RPM as artifact |
| 51 | uses: actions/upload-artifact@v4 |
| 52 | with: |
| 53 | name: rpm-package |
| 54 | path: ${{ steps.find-rpm.outputs.rpm_path }} |
| 55 | |
| 56 | - name: Upload RPM to release |
| 57 | if: github.event_name == 'release' |
| 58 | uses: softprops/action-gh-release@v2 |
| 59 | with: |
| 60 | files: ${{ steps.find-rpm.outputs.rpm_path }} |
| 61 | |
| 62 | build-deb: |
| 63 | runs-on: ubuntu-24.04 |
| 64 | steps: |
| 65 | - uses: actions/checkout@v5 |
| 66 | |
| 67 | - name: Install build dependencies |
| 68 | run: | |
| 69 | sudo apt -y update |
| 70 | sudo apt -y install make gcc libgtk-4-dev libasound2-dev libssl-dev |
| 71 | |
| 72 | - name: Build from sources |
| 73 | run: make -C src -j$(nproc) VERSION=${{ env.APP_VERSION }} PREFIX=/usr |
| 74 | |
| 75 | - name: Prepare package workspace |
| 76 | run: | |
| 77 | mkdir -p deb-workspace/usr/bin \ |
| 78 | deb-workspace/usr/share/applications \ |
| 79 | deb-workspace/usr/share/icons/hicolor/256x256/apps \ |
| 80 | deb-workspace/usr/share/doc/${{ env.APP_NAME }} |
| 81 | cp src/alsa-scarlett-gui deb-workspace/usr/bin/ |
| 82 | cp src/vu.b4.alsa-scarlett-gui.desktop \ |
| 83 | deb-workspace/usr/share/applications/ |
| 84 | cp src/img/vu.b4.alsa-scarlett-gui.png \ |
| 85 | deb-workspace/usr/share/icons/hicolor/256x256/apps/ |
| 86 | cp -r *.md demo docs img deb-workspace/usr/share/doc/${{ env.APP_NAME }}/ |
| 87 | |
| 88 | - name: Build debian package |
| 89 | uses: jiro4989/build-deb-action@v2 |
| 90 | with: |
| 91 | package: ${{ env.APP_NAME }} |
| 92 | package_root: deb-workspace |
| 93 | maintainer: geoffreybennett |
| 94 | depends: 'libgtk-4-1, libasound2, alsa-utils' |
| 95 | version: ${{ env.APP_VERSION }} |
| 96 | desc: > |
| 97 | Gtk4 GUI for the ALSA controls presented by the Linux kernel |
| 98 | Focusrite USB drivers. |
| 99 | |
| 100 | - name: Upload deb as artifact |
| 101 | uses: actions/upload-artifact@v4 |
| 102 | with: |
| 103 | name: deb-package |
| 104 | path: ./${{ env.APP_NAME }}_${{ env.APP_VERSION }}_amd64.deb |
| 105 | |
| 106 | - name: Upload deb to release |
| 107 | if: github.event_name == 'release' |
| 108 | uses: softprops/action-gh-release@v2 |
| 109 | with: |
| 110 | files: ./${{ env.APP_NAME }}_${{ env.APP_VERSION }}_amd64.deb |