ci: restrict workflows to main branch and refactor release process to use cross-compilation for multi-platform artifact generation
CI / Build Windows (push) Has been cancelled
Release / check-release (push) Successful in 14s
Release / build_executable (convertis, x86_64-unknown-linux-gnu) (push) Has been skipped
Release / build_executable (convertis, x86_64-unknown-linux-musl) (push) Has been skipped
Release / build_executable (convertis.exe, x86_64-pc-windows-gnu) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-gnu, deb-gnu) (push) Has been skipped
Release / build_package (x86_64-pc-windows-gnu, exe) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-musl, deb-musl) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-gnu, rpm-gnu) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-musl, rpm-musl) (push) Has been skipped
Release / publish-release (push) Has been skipped
CI / Test (push) Successful in 2m15s
CI / Build Linux (push) Successful in 2m40s

This commit is contained in:
Elias Wendland
2026-07-01 16:59:49 +02:00
parent e030513d57
commit 5f2863cbbd
2 changed files with 101 additions and 51 deletions
+2 -2
View File
@@ -2,9 +2,9 @@ name: CI
on:
push:
branches: [ "main", "master" ]
branches: [ "main" ]
pull_request:
branches: [ "main", "master" ]
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
+96 -46
View File
@@ -2,7 +2,7 @@ name: Release
on:
push:
branches: [ "main", "master" ]
branches: [ "main" ]
jobs:
check-release:
@@ -23,55 +23,107 @@ jobs:
echo "match=false" >> $GITHUB_OUTPUT
fi
build-release-assets:
build_executable:
needs: check-release
if: needs.check-release.outputs.match == 'true'
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
- target: x86_64-unknown-linux-gnu
binary: convertis
- target: x86_64-pc-windows-gnu
binary: convertis.exe
- target: x86_64-unknown-linux-musl
binary: convertis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repo
- uses: dtolnay/rust-toolchain@stable
name: Set up Rust Toolchain
with:
targets: ${{ matrix.target }}
- name: Install cross-platform linkers
run: |
sudo apt-get update
if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then
sudo apt-get install -y mingw-w64
elif [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
sudo apt-get install -y musl-tools
fi
- name: Build
run: cargo build --release
run: cargo build --release --target ${{ matrix.target }}
- name: Build deb and rpm
if: matrix.os == 'ubuntu-latest'
- name: Upload Executable Artifact
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
build_package:
needs: build_executable
if: needs.check-release.outputs.match == 'true'
strategy:
matrix:
include:
- type: deb-gnu
target: x86_64-unknown-linux-gnu
- type: deb-musl
target: x86_64-unknown-linux-musl
- type: rpm-gnu
target: x86_64-unknown-linux-gnu
- type: rpm-musl
target: x86_64-unknown-linux-musl
- type: exe
target: x86_64-pc-windows-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download compiled binary
uses: actions/download-artifact@v4
with:
name: bin-${{ matrix.target }}
path: target/${{ matrix.target }}/release/
- name: Install deb build dependencies
if: startsWith(matrix.type, 'deb-')
run: cargo install cargo-deb
- name: Install rpm build dependencies
if: startsWith(matrix.type, 'rpm-')
run: cargo install cargo-generate-rpm
- name: Build deb
if: startsWith(matrix.type, 'deb-')
run: cargo deb --no-build --target ${{ matrix.target }}
- name: Build rpm
if: startsWith(matrix.type, 'rpm-')
run: cargo generate-rpm --target-dir target/${{ matrix.target }}
- name: Gather packages for upload
run: |
cargo install cargo-deb cargo-generate-rpm
cargo deb
cargo generate-rpm
cp target/debian/*.deb convertis.deb
cp target/generate-rpm/*.rpm convertis.rpm
mkdir -p dist/
if [ "${{ matrix.type }}" = "exe" ]; then
cp target/${{ matrix.target }}/release/convertis.exe dist/
elif [[ "${{ matrix.type }}" == deb-* ]]; then
cp target/${{ matrix.target }}/debian/*.deb dist/
elif [[ "${{ matrix.type }}" == rpm-* ]]; then
cp target/${{ matrix.target }}/generate-rpm/*.rpm dist/
fi
- name: Rename exe
if: matrix.os == 'windows-latest'
run: copy target\release\convertis.exe convertis.exe
- name: Upload Linux Assets
if: matrix.os == 'ubuntu-latest'
- name: Upload Package Artifact
uses: actions/upload-artifact@v4
with:
name: linux-assets
path: |
convertis.deb
convertis.rpm
- name: Upload Windows Assets
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-assets
path: convertis.exe
name: pkg-${{ matrix.type }}
path: dist/*
publish-release:
needs: [check-release, build-release-assets]
needs: [check-release, build_package]
runs-on: ubuntu-latest
permissions:
contents: write
@@ -80,15 +132,12 @@ jobs:
with:
fetch-depth: 0
- name: Download Linux Assets
- name: Download All Packages
uses: actions/download-artifact@v4
with:
name: linux-assets
- name: Download Windows Assets
uses: actions/download-artifact@v4
with:
name: windows-assets
pattern: pkg-*
path: all-packages/
merge-multiple: true
- name: Generate Changelog
run: |
@@ -109,11 +158,12 @@ jobs:
echo "### Others" >> changelog.md
grep -vi "^- feat:\|^- fix:\|^- refactor:\|^- chore:\|^- style:" commits.txt >> changelog.md || echo "No other changes" >> changelog.md
- name: Create Release
- name: Create Gitea Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-release.outputs.version }}
name: Release v${{ needs.check-release.outputs.version }}
body_path: changelog.md
files: all-packages/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ needs.check-release.outputs.version }}" \
--title "Release v${{ needs.check-release.outputs.version }}" \
--notes-file changelog.md \
convertis.deb convertis.rpm convertis.exe