|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 7 | + |
| 8 | +jobs: |
| 9 | + create-release: |
| 10 | + name: Create Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + - name: Create Release |
| 17 | + id: create_release |
| 18 | + uses: actions/create-release@v1 |
| 19 | + env: |
| 20 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + with: |
| 22 | + tag_name: ${{ github.ref }} |
| 23 | + release_name: Release ${{ github.ref }} |
| 24 | + draft: false |
| 25 | + prerelease: false |
| 26 | + |
| 27 | +build-and-upload: |
| 28 | + name: Build and Upload |
| 29 | + needs: create-release |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + include: |
| 33 | + - os: ubuntu-latest |
| 34 | + asset_name: LightweightPomodoroTimer-linux-x86_64.tar.gz |
| 35 | + command: | |
| 36 | + strip target/release/PomodoroTimer |
| 37 | + tar -czvf LightweightPomodoroTimer-linux.tar.gz -C target/release PomodoroTimer |
| 38 | + - os: windows-latest |
| 39 | + asset_name: LightweightPomodoroTimer-windows-x86_64.zip |
| 40 | + command: | |
| 41 | + strip target/release/PomodoroTimer.exe |
| 42 | + 7z a LightweightPomodoroTimer-windows.zip ./target/release/PomodoroTimer.exe |
| 43 | + - os: macos-latest |
| 44 | + asset_name: LightweightPomodoroTimer-macos-x86_64.zip |
| 45 | + command: | |
| 46 | + strip target/release/PomodoroTimer |
| 47 | + zip LightweightPomodoroTimer-macos.zip target/release/PomodoroTimer |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + - uses: actions-rs/toolchain@v1 |
| 52 | + with: |
| 53 | + toolchain: stable |
| 54 | + profile: minimal |
| 55 | + |
| 56 | + - name: Install Linux dependencies |
| 57 | + if: matrix.os == 'ubuntu-latest' |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y libfontconfig1-dev libgtk-3-dev |
| 61 | +
|
| 62 | + - name: Build |
| 63 | + run: cargo build --release --locked |
| 64 | + |
| 65 | + - name: Package |
| 66 | + run: ${{ matrix.command }} |
| 67 | + shell: bash |
| 68 | + |
| 69 | + - name: Upload Release Asset |
| 70 | + uses: actions/upload-release-asset@v1 |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + with: |
| 74 | + upload_url: ${{ needs.create-release.outputs.upload_url }} |
| 75 | + asset_path: ./${{ matrix.asset_name }} |
| 76 | + asset_name: ${{ matrix.asset_name }} |
| 77 | + asset_content_type: application/octet-stream |
0 commit comments