|
| 1 | +name: Release |
| 2 | +permissions: |
| 3 | + contents: write |
| 4 | + |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: [published] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Test on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v5 |
| 18 | + - uses: mlugg/setup-zig@v2 |
| 19 | + with: |
| 20 | + version: 0.15.2 |
| 21 | + - name: Run Tests |
| 22 | + run: zig build test |
| 23 | + |
| 24 | + |
| 25 | + build-library: |
| 26 | + name: Build Library (${{ matrix.target }}) |
| 27 | + needs: test |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + target: |
| 32 | + - x86_64-windows |
| 33 | + - x86-windows |
| 34 | + - x86_64-linux |
| 35 | + - aarch64-linux |
| 36 | + - x86_64-macos |
| 37 | + - aarch64-macos |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v5 |
| 40 | + - uses: mlugg/setup-zig@v2 |
| 41 | + with: |
| 42 | + version: 0.15.2 |
| 43 | + |
| 44 | + - name: Build Library |
| 45 | + run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }} |
| 46 | + |
| 47 | + - name: Prepare Release Artifacts |
| 48 | + run: | |
| 49 | + mkdir -p release |
| 50 | + touch release/placeholder-${{ matrix.target }}.txt |
| 51 | +
|
| 52 | + - name: Upload Release Artifacts |
| 53 | + run: | |
| 54 | + gh release upload "${{ github.event.release.tag_name }}" release/* --clobber || true |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 57 | + |
| 58 | + update-release: |
| 59 | + name: Update Release Description |
| 60 | + needs: [test] |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v5 |
| 64 | + |
| 65 | + - name: Get Release URL |
| 66 | + id: get_url |
| 67 | + run: echo "url=https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz" >> $GITHUB_OUTPUT |
| 68 | + |
| 69 | + - uses: mlugg/setup-zig@v2 |
| 70 | + with: |
| 71 | + version: 0.15.2 |
| 72 | + |
| 73 | + - name: Calculate Hash |
| 74 | + id: calc_hash |
| 75 | + run: | |
| 76 | + HASH=$(zig fetch ${{ steps.get_url.outputs.url }}) |
| 77 | + echo "hash=$HASH" >> $GITHUB_OUTPUT |
| 78 | +
|
| 79 | + - name: Update Release Body |
| 80 | + uses: softprops/action-gh-release@v1 |
| 81 | + with: |
| 82 | + body: | |
| 83 | + ${{ github.event.release.body }} |
| 84 | +
|
| 85 | + ## 📃 Documentation |
| 86 | + https://muhammad-fiaz.github.io/zix/ |
| 87 | +
|
| 88 | + ## 📦 Installation |
| 89 | + ```bash |
| 90 | + zig fetch --save https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz |
| 91 | + ``` |
| 92 | + |
| 93 | + Hash: |
| 94 | + ```zig |
| 95 | + .hash = "${{ steps.calc_hash.outputs.hash }}" |
| 96 | + ``` |
| 97 | +
|
| 98 | +
|
0 commit comments