Skip to content

fix: release workflow only version tags; #54

fix: release workflow only version tags;

fix: release workflow only version tags; #54

Workflow file for this run

name: publish release
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
arch:
- x86_64
- aarch64
exclude:
- os: windows-latest
arch: aarch64
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: '${{ runner.os }}-cargo-${{ hashFiles(''**/Cargo.lock'') }}'
-
name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y protobuf-compiler libprotobuf-dev gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
which cargo-zigbuild || cargo install cargo-zigbuild
sudo snap install zig --classic --beta
-
name: Install dependencies (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
mkdir third_party;
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-win64.zip -OutFile ./third_party/protoc-25.1-win64.zip;
Expand-Archive -Path ./third_party/protoc-25.1-win64.zip -DestinationPath ./third_party;
-
name: Build release (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
$env:PROTOC = "${{ github.workspace }}/third_party/bin/protoc.exe";
cargo build --release;
-
name: Build release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
run: cargo build --release
-
name: Build release (Linux aarch64)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
run: cargo zigbuild --target aarch64-unknown-linux-gnu --release
-
name: Rename release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
run: |
mv ./target/release/turn-balance-server ./target/release/turn-balance-server-linux-x86_64
mv ./target/release/turn-server ./target/release/turn-server-linux-x86_64
mv ./target/release/turn-cli ./target/release/turn-cli-linux-x86_64
-
name: Rename release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
run: |
mv ./target/aarch64-unknown-linux-gnu/release/turn-balance-server ./target/aarch64-unknown-linux-gnu/release/turn-balance-server-linux-aarch64
mv ./target/aarch64-unknown-linux-gnu/release/turn-server ./target/aarch64-unknown-linux-gnu/release/turn-server-linux-aarch64
mv ./target/aarch64-unknown-linux-gnu/release/turn-cli ./target/aarch64-unknown-linux-gnu/release/turn-cli-linux-aarch64
-
name: Rename release (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
Remove-Item -Path "./target/release/turn-balance-server-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Remove-Item -Path "./target/release/turn-server-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Remove-Item -Path "./target/release/turn-cli-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Rename-Item -Path "./target/release/turn-balance-server.exe" -NewName "turn-balance-server-windows-x86_64.exe";
Rename-Item -Path "./target/release/turn-server.exe" -NewName "turn-server-windows-x86_64.exe";
Rename-Item -Path "./target/release/turn-cli.exe" -NewName "turn-cli-windows-x86_64.exe";
-
name: Upload artifact (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v3
with:
name: linux-x86_64
path: |
./target/release/turn-balance-server-linux-x86_64
./target/release/turn-server-linux-x86_64
./target/release/turn-cli-linux-x86_64
-
name: Upload artifact (Linux)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
uses: actions/upload-artifact@v3
with:
name: linux-x86_64
path: |
./target/aarch64-unknown-linux-gnu/release/turn-balance-server-linux-aarch64
./target/aarch64-unknown-linux-gnu/release/turn-server-linux-aarch64
./target/aarch64-unknown-linux-gnu/release/turn-cli-linux-aarch64
-
name: Upload artifact (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v3
with:
name: windows-x86_64
path: |
./target/release/turn-balance-server-windows-x86_64.exe
./target/release/turn-server-windows-x86_64.exe
./target/release/turn-cli-windows-x86_64.exe
deploy:
needs: build
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v3
-
name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
-
name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
files: artifacts/**/*