|
| 1 | +name: Release Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-windows: |
| 9 | + runs-on: windows-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + |
| 13 | + - name: Install Rust |
| 14 | + uses: actions-rs/toolchain@v1 |
| 15 | + with: |
| 16 | + toolchain: stable |
| 17 | + override: true |
| 18 | + |
| 19 | + - name: Build Netter.exe |
| 20 | + run: cargo build --release |
| 21 | + |
| 22 | + - name: Build Netter_service.exe |
| 23 | + run: cargo build --release -p netter_service |
| 24 | + |
| 25 | + - name: Prepare artifacts |
| 26 | + run: | |
| 27 | + mkdir dist |
| 28 | + copy target\release\Netter.exe dist\ |
| 29 | + copy target\release\Netter_service.exe dist\ |
| 30 | +
|
| 31 | + - name: Make zip archive |
| 32 | + run: | |
| 33 | + $tag = "${{ github.ref_name }}" |
| 34 | + Compress-Archive -Path dist\* -DestinationPath "netter-$tag-windows-x86_64.zip" |
| 35 | + shell: pwsh |
| 36 | + |
| 37 | + - name: Upload binaries |
| 38 | + uses: softprops/action-gh-release@v2 |
| 39 | + with: |
| 40 | + files: netter-*-windows-x86_64.zip |
| 41 | + env: |
| 42 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + |
| 44 | + build-linux: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Install Rust |
| 50 | + uses: actions-rs/toolchain@v1 |
| 51 | + with: |
| 52 | + toolchain: stable |
| 53 | + override: true |
| 54 | + |
| 55 | + - name: Build Netter |
| 56 | + run: cargo build --release |
| 57 | + |
| 58 | + - name: Build Netter_service |
| 59 | + run: cargo build --release -p netter_service |
| 60 | + |
| 61 | + - name: Prepare artifacts |
| 62 | + run: | |
| 63 | + mkdir dist |
| 64 | + cp target/release/Netter dist/ |
| 65 | + cp target/release/Netter_service dist/ |
| 66 | +
|
| 67 | + - name: Make tar.gz archive |
| 68 | + run: | |
| 69 | + tag="${GITHUB_REF_NAME}" |
| 70 | + tar -czvf "netter-${tag}-linux-x86_64.tar.gz" -C dist Netter Netter_service |
| 71 | +
|
| 72 | + - name: Upload binaries |
| 73 | + uses: softprops/action-gh-release@v2 |
| 74 | + with: |
| 75 | + files: netter-*-linux-x86_64.tar.gz |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments