Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
prepare:
name: Prepare release
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
tag_name: ${{ steps.release_info.outputs.tag_name }}
release_name: ${{ steps.release_info.outputs.release_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Compute release name and tag
id: release_info
run: |
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT

release:
name: ${{ matrix.target }} (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
needs: prepare
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# `runner`: GHA runner label
# `target`: Rust build target triple
# `platform` and `arch`: Used in tarball names
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux
arch: amd64
- runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
platform: linux
arch: arm64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Linux ARM setup
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo mv /etc/apt/sources.list /etc/apt/sources.list.d/amd64.list
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu noble main" | sudo tee -a /etc/apt/sources.list.d/amd64.list
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu noble-updates main" | sudo tee -a /etc/apt/sources.list.d/amd64.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble main" | sudo tee -a /etc/apt/sources.list.d/arm64-ports.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates main" | sudo tee -a /etc/apt/sources.list.d/arm64.list
sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install -y crossbuild-essential-arm64 libssl-dev:arm64 libssl3t64:arm64
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV

- name: Build binaries
shell: bash
run: |
set -eo pipefail
target="${{ matrix.target }}"

cargo build --release --bins --target "$target" --workspace

- name: Archive binaries
id: artifacts
env:
PLATFORM_NAME: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
ARCH: ${{ matrix.arch }}
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
shell: bash
run: |
if [ "$PLATFORM_NAME" == "linux" ]; then
tar -czvf "ue-rs_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release download_sysext
echo "file_name=ue-rs_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
fi

# Creates the release for this specific version
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.prepare.outputs.release_name }}
tag_name: ${{ needs.prepare.outputs.tag_name }}
body:
files: |
${{ steps.artifacts.outputs.file_name }}