Release Binaries #23
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Binaries | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Тег релиза (например, v0.5.0). Если пусто — будет использоваться текущий тег релиза.' | |
| required: false | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build netter.exe | |
| run: cargo build --release | |
| - name: Build netter_service.exe | |
| run: cargo build --release -p netter_service | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir dist | |
| copy target\release\netter.exe dist\ | |
| copy target\release\netter_service.exe dist\ | |
| - name: Determine tag name | |
| id: get_tag | |
| run: | | |
| if ($env:GITHUB_EVENT_NAME -eq 'release') { | |
| $tag = "${env:GITHUB_REF_NAME}" | |
| } elseif ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch' -and "${{ github.event.inputs.tag }}") { | |
| $tag = "${{ github.event.inputs.tag }}" | |
| } else { | |
| Write-Host "ERROR: Тег релиза не определён!" | |
| exit 1 | |
| } | |
| echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Make zip archive | |
| run: | | |
| $tag = "${{ steps.get_tag.outputs.tag }}" | |
| Compress-Archive -Path dist\* -DestinationPath "netter-$tag-windows-x86_64.zip" | |
| shell: pwsh | |
| - name: Upload binaries to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_tag.outputs.tag }} | |
| files: netter-*-windows-x86_64.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build netter | |
| run: cargo build --release | |
| - name: Build netter_service | |
| run: cargo build --release -p netter_service | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir dist | |
| cp target/release/netter dist/ | |
| cp target/release/netter_service dist/ | |
| - name: Determine tag name | |
| id: get_tag | |
| run: | | |
| if [ "${GITHUB_EVENT_NAME}" = "release" ]; then | |
| tag="${GITHUB_REF_NAME}" | |
| elif [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.tag }}" ]; then | |
| tag="${{ github.event.inputs.tag }}" | |
| else | |
| echo "ERROR: Тег релиза не определён!" | |
| exit 1 | |
| fi | |
| echo "tag=$tag" >> $GITHUB_OUTPUT | |
| - name: Make tar.gz archive | |
| run: | | |
| tag="${{ steps.get_tag.outputs.tag }}" | |
| cd dist | |
| tar -czvf "../netter-${tag}-linux-x86_64.tar.gz" netter netter_service | |
| - name: Upload binaries to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_tag.outputs.tag }} | |
| files: netter-*-linux-x86_64.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |