Update release.yml #71
Workflow file for this run
This file contains 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: publish release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: '${{ matrix.os }}' | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
target: | |
- aarch64-apple-darwin | |
- aarch64-pc-windows-msvc | |
- aarch64-unknown-linux-musl | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
- x86_64-unknown-linux-musl | |
include: | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
steps: | |
- | |
uses: actions/checkout@v4 | |
- | |
uses: actions/cache@v4 | |
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 gcc-aarch64-linux-musl | |
rustup target add ${{ matrix.target }} | |
cargo install cargo-zigbuild | |
sudo snap install zig --classic --beta | |
- | |
name: Install dependencies (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo install cargo-zigbuild | |
choco install zig | |
- | |
name: Install dependencies (Macos) | |
if: runner.os == 'Macos' | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo install cargo-zigbuild | |
brew install zig | |
- | |
name: Build release | |
run: cargo zigbuild --target ${{ matrix.target }} --release | |
- | |
name: Rename release (Linux & Macos) | |
if: runner.os == 'Macos' || runner.os == 'Linux' | |
run: | | |
mv ./target/release/turn-server ./target/release/turn-server-${{ matrix.target }} | |
- | |
name: Rename release (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
Remove-Item -Path "./target/release/turn-server-${{ matrix.target }}.exe" -ErrorAction SilentlyContinue; | |
Rename-Item -Path "./target/release/turn-server.exe" -NewName "turn-server-${{ matrix.target }}.exe"; | |
- | |
name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
./target/release/turn-server-${{ matrix.target }} | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
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/**/* |