|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - 'v*.*.*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + name: Release |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Rust toolchain |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + |
| 25 | + - name: Build |
| 26 | + run: cargo build --release --locked |
| 27 | + |
| 28 | + - name: Prepare artifacts for Windows |
| 29 | + if: matrix.os == 'windows-latest' |
| 30 | + run: | |
| 31 | + mv target/release/ascii-rs.exe target/release/ascii-rs-windows-${{ github.ref }}.exe |
| 32 | + shell: bash |
| 33 | + |
| 34 | + - name: Prepare artifacts for Linux |
| 35 | + if: matrix.os == 'ubuntu-latest' |
| 36 | + run: | |
| 37 | + mv target/release/ascii-rs target/release/ascii-rs-ubuntu-${{ github.ref }} |
| 38 | + shell: bash |
| 39 | + |
| 40 | + - name: Prepare artifacts for macOS |
| 41 | + if: matrix.os == 'macos-latest' |
| 42 | + run: | |
| 43 | + mv target/release/ascii-rs target/release/ascii-rs-macos-${{ github.ref }} |
| 44 | + shell: bash |
| 45 | + |
| 46 | + - name: Upload artifacts |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: ascii-rs-${{ matrix.os }} |
| 50 | + path: | |
| 51 | + target/release/ascii-rs-ubuntu-${{ github.ref }} |
| 52 | + target/release/ascii-rs-windows-${{ github.ref }}.exe |
| 53 | + target/release/ascii-rs-macos-${{ github.ref }} |
| 54 | +
|
| 55 | + create-release: |
| 56 | + name: Create Release |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: release |
| 59 | + steps: |
| 60 | + - name: Download all artifacts |
| 61 | + uses: actions/download-artifact@v4 |
| 62 | + with: |
| 63 | + path: artifacts |
| 64 | + |
| 65 | + - name: Create Release and Upload Assets |
| 66 | + uses: softprops/action-gh-release@v2 |
| 67 | + with: |
| 68 | + prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }} |
| 69 | + files: | |
| 70 | + artifacts/ascii-rs-ubuntu-${{ github.ref }}/ascii-rs-ubuntu-${{ github.ref }} |
| 71 | + artifacts/ascii-rs-windows-${{ github.ref }}.exe/ascii-rs-windows-${{ github.ref }}.exe |
| 72 | + artifacts/ascii-rs-macos-${{ github.ref }}/ascii-rs-macos-${{ github.ref }} |
0 commit comments