| 1 | name: Release |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - '*.*.*' |
| 7 | |
| 8 | jobs: |
| 9 | |
| 10 | ghrelease: |
| 11 | name: Publish sources on GitHub Release |
| 12 | runs-on: ubuntu-latest |
| 13 | steps: |
| 14 | - name: Checkout |
| 15 | uses: actions/checkout@v3 |
| 16 | - name: Configure |
| 17 | run: | |
| 18 | ./bootstrap.sh |
| 19 | ./configure |
| 20 | - name: Build source packages |
| 21 | run: | |
| 22 | make dist |
| 23 | bzip2 -d -k bzip3-${{ github.ref_name }}.tar.bz2 |
| 24 | zstd -19 bzip3-${{ github.ref_name }}.tar |
| 25 | 7z a bzip3-${{ github.ref_name}}.tar{.7z,} |
| 26 | - name: Build a binary (for dogfooding) |
| 27 | run: make |
| 28 | - name: Create a dogfood package |
| 29 | run: | |
| 30 | ./bzip3 -e bzip3-${{ github.ref_name }}.tar |
| 31 | - name: Publish Release |
| 32 | uses: softprops/action-gh-release@v1 |
| 33 | with: |
| 34 | files: | |
| 35 | bzip3-${{ github.ref_name }}.tar |
| 36 | bzip3-${{ github.ref_name }}.tar.7z |
| 37 | bzip3-${{ github.ref_name }}.tar.bz2 |
| 38 | bzip3-${{ github.ref_name }}.tar.bz3 |
| 39 | bzip3-${{ github.ref_name }}.tar.gz |
| 40 | bzip3-${{ github.ref_name }}.tar.xz |
| 41 | bzip3-${{ github.ref_name }}.tar.zst |
| 42 | bzip3-${{ github.ref_name }}.zip |
| 43 | - name: Upload source package artifact |
| 44 | uses: actions/upload-artifact@v4 |
| 45 | with: |
| 46 | name: bzip3-${{ github.ref_name }} |
| 47 | path: bzip3-${{ github.ref_name }}.tar.gz |
| 48 | |
| 49 | binaries: |
| 50 | name: Publish Binaries on GitHub Release |
| 51 | needs: [ ghrelease ] |
| 52 | runs-on: ubuntu-latest |
| 53 | strategy: |
| 54 | fail-fast: false |
| 55 | matrix: |
| 56 | target: |
| 57 | - [ "x86_64-linux", "--enable-static-exe --disable-arch-native", "" ] |
| 58 | - [ "x86_64", "CC=x86_64-w64-mingw32-gcc --host x86_64-w64-mingw32 --enable-static-exe --disable-arch-native", "gcc-mingw-w64-x86-64" ] |
| 59 | - [ "i686", "CC=i686-w64-mingw32-gcc --host i686-w64-mingw32 --enable-static-exe --disable-arch-native", "gcc-mingw-w64-i686" ] |
| 60 | steps: |
| 61 | - name: Download source package artifact |
| 62 | uses: actions/download-artifact@v4 |
| 63 | with: |
| 64 | name: bzip3-${{ github.ref_name }} |
| 65 | - name: Extract source package |
| 66 | run: tar --strip-components=1 -xf bzip3-${{ github.ref_name }}.tar.gz |
| 67 | - name: Install cross-compile dependencies |
| 68 | if: ${{ matrix.target[2] }} |
| 69 | run: | |
| 70 | sudo apt-get update |
| 71 | sudo apt-get install -y ${{ matrix.target[2] }} |
| 72 | - name: Configure |
| 73 | run: ./configure --bindir=/ --program-suffix=-${{ matrix.target[0] }} ${{ matrix.target[1] }} |
| 74 | - name: Make |
| 75 | run: | |
| 76 | make |
| 77 | make DESTDIR=$(pwd)/output install-exec |
| 78 | - name: Publish binary |
| 79 | uses: softprops/action-gh-release@v1 |
| 80 | with: |
| 81 | files: | |
| 82 | output/bzip3-${{ matrix.target[0] }}* |