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: on:
push: push:
branches: [ "main", "master" ] branches: [ "main" ]
pull_request: pull_request:
branches: [ "main", "master" ] branches: [ "main" ]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
+96 -46
View File
@@ -2,7 +2,7 @@ name: Release
on: on:
push: push:
branches: [ "main", "master" ] branches: [ "main" ]
jobs: jobs:
check-release: check-release:
@@ -23,55 +23,107 @@ jobs:
echo "match=false" >> $GITHUB_OUTPUT echo "match=false" >> $GITHUB_OUTPUT
fi fi
build-release-assets: build_executable:
needs: check-release needs: check-release
if: needs.check-release.outputs.match == 'true' if: needs.check-release.outputs.match == 'true'
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest - target: x86_64-unknown-linux-gnu
target: x86_64-unknown-linux-gnu binary: convertis
- os: windows-latest - target: x86_64-pc-windows-gnu
target: x86_64-pc-windows-msvc binary: convertis.exe
runs-on: ${{ matrix.os }} - target: x86_64-unknown-linux-musl
binary: convertis
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
name: Checkout repo
- uses: dtolnay/rust-toolchain@stable - 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 - name: Build
run: cargo build --release run: cargo build --release --target ${{ matrix.target }}
- name: Build deb and rpm - name: Upload Executable Artifact
if: matrix.os == 'ubuntu-latest' 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: | run: |
cargo install cargo-deb cargo-generate-rpm mkdir -p dist/
cargo deb if [ "${{ matrix.type }}" = "exe" ]; then
cargo generate-rpm cp target/${{ matrix.target }}/release/convertis.exe dist/
cp target/debian/*.deb convertis.deb elif [[ "${{ matrix.type }}" == deb-* ]]; then
cp target/generate-rpm/*.rpm convertis.rpm cp target/${{ matrix.target }}/debian/*.deb dist/
elif [[ "${{ matrix.type }}" == rpm-* ]]; then
cp target/${{ matrix.target }}/generate-rpm/*.rpm dist/
fi
- name: Rename exe - name: Upload Package Artifact
if: matrix.os == 'windows-latest'
run: copy target\release\convertis.exe convertis.exe
- name: Upload Linux Assets
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: linux-assets name: pkg-${{ matrix.type }}
path: | path: dist/*
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
publish-release: publish-release:
needs: [check-release, build-release-assets] needs: [check-release, build_package]
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@@ -80,15 +132,12 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Download Linux Assets - name: Download All Packages
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: linux-assets pattern: pkg-*
path: all-packages/
- name: Download Windows Assets merge-multiple: true
uses: actions/download-artifact@v4
with:
name: windows-assets
- name: Generate Changelog - name: Generate Changelog
run: | run: |
@@ -109,11 +158,12 @@ jobs:
echo "### Others" >> changelog.md echo "### Others" >> changelog.md
grep -vi "^- feat:\|^- fix:\|^- refactor:\|^- chore:\|^- style:" commits.txt >> changelog.md || echo "No other changes" >> 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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