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
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:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
- name: Build
|
with:
|
||||||
run: cargo build --release
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build deb and rpm
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
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
|
|
||||||
|
|
||||||
- name: Rename exe
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: copy target\release\convertis.exe convertis.exe
|
|
||||||
|
|
||||||
- name: Upload Linux Assets
|
- name: Install cross-platform linkers
|
||||||
if: matrix.os == 'ubuntu-latest'
|
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 --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Upload Executable Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux-assets
|
name: bin-${{ matrix.target }}
|
||||||
path: |
|
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
|
||||||
convertis.deb
|
|
||||||
convertis.rpm
|
build_package:
|
||||||
|
needs: build_executable
|
||||||
- name: Upload Windows Assets
|
if: needs.check-release.outputs.match == 'true'
|
||||||
if: matrix.os == 'windows-latest'
|
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: |
|
||||||
|
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: Upload Package Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: windows-assets
|
name: pkg-${{ matrix.type }}
|
||||||
path: convertis.exe
|
path: dist/*
|
||||||
|
|
||||||
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
|
||||||
@@ -79,16 +131,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Download Linux Assets
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: linux-assets
|
|
||||||
|
|
||||||
- name: Download Windows Assets
|
- name: Download All Packages
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: windows-assets
|
pattern: pkg-*
|
||||||
|
path: all-packages/
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- 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
|
|
||||||
Reference in New Issue
Block a user