|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - target: x86_64-apple-darwin |
| 17 | + os: macos-latest |
| 18 | + - target: aarch64-apple-darwin |
| 19 | + os: macos-latest |
| 20 | + - target: x86_64-unknown-linux-gnu |
| 21 | + os: ubuntu-latest |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - uses: dtolnay/rust-toolchain@stable |
| 27 | + with: |
| 28 | + targets: ${{ matrix.target }} |
| 29 | + |
| 30 | + - name: Build |
| 31 | + run: cargo build --release --target ${{ matrix.target }} |
| 32 | + |
| 33 | + - name: Package |
| 34 | + run: | |
| 35 | + cd target/${{ matrix.target }}/release |
| 36 | + tar czf ../../../stackpit-${{ matrix.target }}.tar.gz stackpit |
| 37 | + cd ../../.. |
| 38 | + shasum -a 256 stackpit-${{ matrix.target }}.tar.gz > stackpit-${{ matrix.target }}.tar.gz.sha256 |
| 39 | +
|
| 40 | + - name: Upload artifacts |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + with: |
| 43 | + name: stackpit-${{ matrix.target }} |
| 44 | + path: | |
| 45 | + stackpit-${{ matrix.target }}.tar.gz |
| 46 | + stackpit-${{ matrix.target }}.tar.gz.sha256 |
| 47 | +
|
| 48 | + deb: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - uses: dtolnay/rust-toolchain@stable |
| 54 | + |
| 55 | + - name: Install cargo-deb |
| 56 | + run: cargo install cargo-deb |
| 57 | + |
| 58 | + - name: Build deb package |
| 59 | + run: cargo deb |
| 60 | + |
| 61 | + - name: Upload deb artifact |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: stackpit-deb |
| 65 | + path: target/debian/*.deb |
| 66 | + |
| 67 | + rpm: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + |
| 72 | + - uses: dtolnay/rust-toolchain@stable |
| 73 | + |
| 74 | + - name: Install cargo-generate-rpm |
| 75 | + run: cargo install cargo-generate-rpm |
| 76 | + |
| 77 | + - name: Build |
| 78 | + run: cargo build --release |
| 79 | + |
| 80 | + - name: Build rpm package |
| 81 | + run: cargo generate-rpm |
| 82 | + |
| 83 | + - name: Upload rpm artifact |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: stackpit-rpm |
| 87 | + path: target/generate-rpm/*.rpm |
| 88 | + |
| 89 | + release: |
| 90 | + needs: [build, deb, rpm] |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + - name: Download artifacts |
| 94 | + uses: actions/download-artifact@v4 |
| 95 | + with: |
| 96 | + merge-multiple: true |
| 97 | + |
| 98 | + - name: Create release |
| 99 | + uses: softprops/action-gh-release@v2 |
| 100 | + with: |
| 101 | + generate_release_notes: true |
| 102 | + draft: false |
| 103 | + files: | |
| 104 | + stackpit-*.tar.gz |
| 105 | + stackpit-*.tar.gz.sha256 |
| 106 | + *.deb |
| 107 | + *.rpm |
0 commit comments