|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + arch: [amd64, arm64] |
| 17 | + steps: |
| 18 | + - name: Checkout phiola |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Get the dependencies |
| 24 | + run: | |
| 25 | + git clone --depth=1 https://github.com/stsaz/netmill ../netmill |
| 26 | + git clone --depth=1 https://github.com/stsaz/avpack ../avpack |
| 27 | + git clone --depth=1 https://github.com/stsaz/ffaudio ../ffaudio |
| 28 | + git clone --depth=1 https://github.com/stsaz/ffpack ../ffpack |
| 29 | + git clone --depth=1 https://github.com/stsaz/ffgui ../ffgui |
| 30 | + git clone --depth=1 https://github.com/stsaz/ffsys ../ffsys |
| 31 | + git clone --depth=1 https://github.com/stsaz/ffbase ../ffbase |
| 32 | +
|
| 33 | + - name: Create builder image |
| 34 | + run: | |
| 35 | + if [[ "${{ matrix.arch }}" == "amd64" ]]; then |
| 36 | + podman build -t phiola-amd64-builder -f builder/Dockerfile.linux-amd64 . |
| 37 | + else |
| 38 | + podman build -t phiola-arm64-builder -f builder/Dockerfile.linux-arm64 . |
| 39 | + fi |
| 40 | +
|
| 41 | + - name: Build for ${{ matrix.arch }} |
| 42 | + run: | |
| 43 | + if [[ "${{ matrix.arch }}" == "amd64" ]]; then |
| 44 | + cat <<'EOF' >build.sh |
| 45 | + export PATH=$PATH:/usr/lib/llvm-19/bin |
| 46 | + mkdir -p _linux-amd64 |
| 47 | + make -j$(nproc) \ |
| 48 | + -C _linux-amd64 \ |
| 49 | + -f ../Makefile \ |
| 50 | + ROOT_DIR=../.. \ |
| 51 | + COMPILER=clang \ |
| 52 | + CFLAGS_USER=-fno-diagnostics-color \ |
| 53 | + release |
| 54 | + EOF |
| 55 | + else |
| 56 | + cat <<'EOF' >build.sh |
| 57 | + export PATH=$PATH:/usr/lib/llvm-19/bin |
| 58 | + export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig |
| 59 | + mkdir -p _linux-arm64 |
| 60 | + make -j$(nproc) \ |
| 61 | + -C _linux-arm64 \ |
| 62 | + -f ../Makefile \ |
| 63 | + ROOT_DIR=../.. \ |
| 64 | + COMPILER=clang \ |
| 65 | + CPU=arm64 \ |
| 66 | + CFLAGS_USER=-fno-diagnostics-color \ |
| 67 | + PHI_HTTP_SSL=0 \ |
| 68 | + release |
| 69 | + EOF |
| 70 | + fi |
| 71 | +
|
| 72 | + podman run --rm \ |
| 73 | + -v $(pwd)/..:/src:Z \ |
| 74 | + -w /src/phiola \ |
| 75 | + phiola-${{ matrix.arch }}-builder \ |
| 76 | + bash build.sh |
| 77 | +
|
| 78 | + - name: Upload artifacts |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: phiola-${{ matrix.arch }} |
| 82 | + path: | |
| 83 | + _linux-${{ matrix.arch }}/phiola_*_${{ matrix.arch }}.deb |
| 84 | + _linux-${{ matrix.arch }}/phiola-*.rpm |
| 85 | + _linux-${{ matrix.arch }}/phiola-*-${{ matrix.arch }}.tar.zst |
| 86 | + _linux-${{ matrix.arch }}/phiola-*-${{ matrix.arch }}-debug.tar.zst |
| 87 | +
|
| 88 | + release: |
| 89 | + needs: build |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - name: Checkout phiola |
| 93 | + uses: actions/checkout@v4 |
| 94 | + with: |
| 95 | + fetch-depth: 0 |
| 96 | + |
| 97 | + - name: Download all artifacts |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + path: artifacts |
| 101 | + |
| 102 | + - name: Generate release notes |
| 103 | + run: | |
| 104 | + SINCE=$(git tag --sort=-version:refname | grep -A1 "^${GITHUB_REF_NAME}$" | tail -1) |
| 105 | + { |
| 106 | + echo "Changes since $SINCE:" |
| 107 | + echo '```' |
| 108 | + bash builder/changelog.sh "$SINCE" "${GITHUB_REF_NAME}" |
| 109 | + echo '```' |
| 110 | + } > release-notes.txt |
| 111 | +
|
| 112 | + - name: Create GitHub Release |
| 113 | + uses: softprops/action-gh-release@v2 |
| 114 | + with: |
| 115 | + files: | |
| 116 | + artifacts/phiola-amd64/*.deb |
| 117 | + artifacts/phiola-amd64/*.rpm |
| 118 | + artifacts/phiola-amd64/*.tar.zst |
| 119 | + artifacts/phiola-arm64/*.deb |
| 120 | + artifacts/phiola-arm64/*.rpm |
| 121 | + artifacts/phiola-arm64/*.tar.zst |
| 122 | + draft: true |
| 123 | + body_file: release-notes.txt |
0 commit comments