Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: Build and Package Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: lantun-linux-x86_64.zip
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: lantun-windows-x86_64.zip
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: lantun-macos-x86_64.zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev pkg-config
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary for packaging
shell: bash
run: |
mkdir dist
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
cp target/${{ matrix.target }}/release/lantun.exe dist/
else
cp target/${{ matrix.target }}/release/lantun dist/
fi
- name: Package binary (zip)
shell: bash
run: |
cd dist
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
7z a ../${{ matrix.artifact_name }} lantun.exe
else
zip ../${{ matrix.artifact_name }} lantun
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}
upload:
name: Upload Release Assets
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: ls -R artifacts
- name: Upload assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/**/lantun-*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}