|
| 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.target }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: ubuntu-latest |
| 20 | + target: x86_64-unknown-linux-gnu |
| 21 | + # - os: macos-latest |
| 22 | + # target: x86_64-apple-darwin |
| 23 | + # - os: windows-latest |
| 24 | + # target: x86_64-pc-windows-msvc |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - uses: dtolnay/rust-toolchain@nightly |
| 30 | + with: |
| 31 | + targets: ${{ matrix.target }} |
| 32 | + |
| 33 | + - uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: | |
| 36 | + ~/.cargo/registry |
| 37 | + ~/.cargo/git |
| 38 | + target |
| 39 | + key: ${{ runner.os }}-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }} |
| 40 | + |
| 41 | + - name: Build release |
| 42 | + run: cargo build --release --workspace --target ${{ matrix.target }} |
| 43 | + |
| 44 | + # Smoosh binaries into a .tar.gz per platform |
| 45 | + - name: Package |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + mkdir dist |
| 49 | + cp target/${{ matrix.target }}/release/placy dist/ 2>/dev/null || true |
| 50 | + cp target/${{ matrix.target }}/release/placy.exe dist/ 2>/dev/null || true |
| 51 | + cp target/${{ matrix.target }}/release/placy-server dist/ 2>/dev/null || true |
| 52 | + cp target/${{ matrix.target }}/release/placy-server.exe dist/ 2>/dev/null || true |
| 53 | + tar -czf placy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C dist . |
| 54 | +
|
| 55 | + - uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: placy-${{ matrix.target }} |
| 58 | + path: placy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz |
| 59 | + |
| 60 | + release: |
| 61 | + name: Create Release |
| 62 | + needs: build |
| 63 | + runs-on: ubuntu-latest |
| 64 | + permissions: |
| 65 | + contents: write # needed to create the release |
| 66 | + |
| 67 | + steps: |
| 68 | + - uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + path: artifacts |
| 71 | + merge-multiple: true |
| 72 | + |
| 73 | + - name: Create GitHub Release |
| 74 | + uses: softprops/action-gh-release@v2 |
| 75 | + with: |
| 76 | + name: Release ${{ github.ref_name }} |
| 77 | + generate_release_notes: true # auto-generates changelog from PRs/commits |
| 78 | + files: artifacts/* |
0 commit comments