swfss3/.github/workflows/release.yml
benato.denis96@gmail.com 91ebf47324
Some checks failed
Rust / build (push) Has been cancelled
Chore: add CI
2026-03-12 11:44:21 +01:00

247 lines
No EOL
7.6 KiB
YAML

name: Release
on:
push:
tags:
- '*'
env:
CARGO_TERM_COLOR: always
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
source $HOME/.cargo/env
- name: Install clang-sys Dependencies
run: sudo apt-get install -y clang llvm lld libclang-dev
- name: Build
run: cargo build --verbose
static_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
source $HOME/.cargo/env
- name: Install clang-sys Dependencies
run: sudo apt-get install -y clang llvm lld libclang-dev zip
- name: Install muslc rust toolchain
run: rustup target add x86_64-unknown-linux-musl
- name: Build
run: cargo build --release --target=x86_64-unknown-linux-musl
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Create package
run: |
cp target/x86_64-unknown-linux-musl/release/${{ github.event.repository.name }} .
zip ${{ github.event.repository.name }}-v${{ env.RELEASE_VERSION }}-x86_64.zip ${{ github.event.repository.name }}
rm ${{ github.event.repository.name }}
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: static-package
path: |
*.zip
if-no-files-found: error
fedora_build:
runs-on: ubuntu-latest
container:
image: fedora:43
volumes:
- /usr:/usr-host
- /opt:/opt-host
options: --privileged
steps:
- name: Maximize build space
run: |
df -h
rm -rf /usr-host/share/dotnet || true
rm -rf /usr-host/share/swift || true
rm -rf /usr-host/share/java || true
rm -rf /usr-host/local/lib/android || true
rm -rf /opt-host/ghc || true
rm -rf /opt-host/hostedtoolcache || true
rm -rf /opt-host/az || true
df -h
- uses: actions/checkout@v4
- name: Update system
run: |
dnf -y update || true
- name: Install Basic Software
run: dnf install -y sudo curl
- name: Install Build Dependencies
run: dnf install -y rpm-build redhat-rpm-config make gcc clang pkgconfig
- name: Install Rust toolchain
run: dnf install -y cargo rust
- name: Prepare rpmbuild and build RPM
run: |
mkdir -p rpmbuild/{SOURCES,SPECS,BUILD,RPMS,SRPMS}
cp rpm/*.spec rpmbuild/SPECS/
if [ -f "$PWD/Cargo.lock" ]; then
echo "Fedora is a whiny baby and refuses to use dependencies that are told to be used."
rm -f $PWD/Cargo.lock
else
echo "Cargo.lock not found, skipping removal"
fi
rpmbuild --define "_topdir $PWD/rpmbuild" --define "_sourcedir $PWD" --define "version ${GITHUB_REF#refs/*/}" -ba rpmbuild/SPECS/${{ github.event.repository.name }}.spec
- name: Move rpms
run: |
mv rpmbuild/RPMS/*/*.rpm . || true
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: fedora-package
path: |
*.rpm
if-no-files-found: error
bookworm_build:
runs-on: ubuntu-latest
container:
image: debian:bookworm
volumes:
- /usr:/usr-host
- /opt:/opt-host
options: --privileged
steps:
- name: Maximize build space
run: |
df -h
rm -rf /usr-host/share/dotnet
rm -rf /usr-host/share/swift
rm -rf /usr-host/share/java
rm -rf /usr-host/local/lib/android
rm -rf /opt-host/ghc
rm -rf /opt-host/hostedtoolcache
rm -rf /opt-host/az
df -h
- uses: actions/checkout@v4
- name: Update system
run: |
apt-get update -y
apt-get upgrade -y
- name: Install Basic Software
run: apt-get install -y sudo curl
- name: Install Build Dependencies
run: apt-get install -y build-essential devscripts debhelper
- name: Install clang-sys Dependencies
run: apt-get install -y clang llvm lld libclang-dev
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
- name: Build deb
run: |
. $HOME/.cargo/env
export PATH="$HOME/.cargo/bin:$PATH"
cargo install cargo-deb
cargo deb
- name: Move debs
run: |
mv target/debian/*.deb .
for file in *.deb; do mv "$file" "${file%.deb}.bookworm.deb"; done
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: bookworm-package
path: |
*.deb
if-no-files-found: error
trixie_build:
runs-on: ubuntu-latest
container:
image: debian:trixie
volumes:
- /usr:/usr-host
- /opt:/opt-host
options: --privileged
steps:
- name: Maximize build space
run: |
df -h
rm -rf /usr-host/share/dotnet
rm -rf /usr-host/share/swift
rm -rf /usr-host/share/java
rm -rf /usr-host/local/lib/android
rm -rf /opt-host/ghc
rm -rf /opt-host/hostedtoolcache
rm -rf /opt-host/az
df -h
- uses: actions/checkout@v4
- name: Update system
run: |
apt-get update -y
apt-get upgrade -y
- name: Install Basic Software
run: apt-get install -y sudo curl
- name: Install Build Dependencies
run: apt-get install -y build-essential devscripts debhelper
- name: Install clang-sys Dependencies
run: apt-get install -y clang llvm lld libclang-dev
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
- name: Build deb
run: |
. $HOME/.cargo/env
export PATH="$HOME/.cargo/bin:$PATH"
cargo install cargo-deb
cargo deb
- name: Move debs
run: |
mv target/debian/*.deb .
for file in *.deb; do mv "$file" "${file%.deb}.trixie.deb"; done
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: trixie-package
path: |
*.deb
if-no-files-found: error
make-release:
runs-on: ubuntu-latest
needs: [prepare, static_build, bookworm_build, trixie_build, fedora_build]
steps:
- name: Download static artifacts
uses: actions/download-artifact@v4
with:
name: static-package
path: ${{ env.PKGDEST }}
- name: Download debian bookworm artifacts
uses: actions/download-artifact@v4
with:
name: bookworm-package
path: ${{ env.PKGDEST }}
- name: Download debian trixie artifacts
uses: actions/download-artifact@v4
with:
name: trixie-package
path: ${{ env.PKGDEST }}
- name: Download fedora artifacts
uses: actions/download-artifact@v4
with:
name: fedora-package
path: ${{ env.PKGDEST }}
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Make release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.event.repository.name }} v${{ env.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: true
fail_on_unmatched_files: true
files: |
*.zip
*.rpm
*.deb