|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build ${{ matrix.os }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - os: ubuntu-latest |
| 19 | + artifact_name: junkanoo-ubuntu |
| 20 | + target: x86_64-unknown-linux-gnu |
| 21 | + - os: windows-latest |
| 22 | + artifact_name: junkanoo-windows |
| 23 | + target: x86_64-pc-windows-msvc |
| 24 | + - os: macos-latest |
| 25 | + artifact_name: junkanoo-macos |
| 26 | + target: x86_64-apple-darwin |
| 27 | + - os: ubuntu-latest |
| 28 | + artifact_name: junkanoo-arch |
| 29 | + target: x86_64-unknown-linux-gnu |
| 30 | + is_arch: true |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Install Rust toolchain |
| 36 | + uses: dtolnay/rust-toolchain@stable |
| 37 | + with: |
| 38 | + targets: ${{ matrix.target }} |
| 39 | + |
| 40 | + - name: Cache dependencies |
| 41 | + uses: Swatinem/rust-cache@v2 |
| 42 | + |
| 43 | + - name: Build |
| 44 | + run: cargo build --release --target ${{ matrix.target }} |
| 45 | + |
| 46 | + - name: Install Arch Linux dependencies |
| 47 | + if: matrix.is_arch |
| 48 | + run: | |
| 49 | + sudo pacman -Syu --noconfirm |
| 50 | + sudo pacman -S --noconfirm base-devel |
| 51 | +
|
| 52 | + - name: Build Arch package |
| 53 | + if: matrix.is_arch |
| 54 | + run: | |
| 55 | + makepkg -f |
| 56 | +
|
| 57 | + - name: Upload artifacts |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: ${{ matrix.artifact_name }} |
| 61 | + path: | |
| 62 | + target/${{ matrix.target }}/release/junkanoo* |
| 63 | + *.pkg.tar.zst |
| 64 | + if-no-files-found: error |
| 65 | + |
| 66 | + create-release: |
| 67 | + name: Create Release |
| 68 | + needs: build |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - name: Download all artifacts |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + path: artifacts |
| 75 | + |
| 76 | + - name: Create Release |
| 77 | + id: create_release |
| 78 | + uses: softprops/action-gh-release@v1 |
| 79 | + with: |
| 80 | + files: | |
| 81 | + artifacts/junkanoo-ubuntu/* |
| 82 | + artifacts/junkanoo-windows/* |
| 83 | + artifacts/junkanoo-macos/* |
| 84 | + artifacts/junkanoo-arch/*.pkg.tar.zst |
| 85 | + generate_release_notes: true |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments