Release / publish-release (push) Has been cancelled
Release / build_package (x86_64-pc-windows-gnu, exe) (push) Has been cancelled
CI / Build Windows (push) Has been cancelled
Release / check-release (push) Successful in 15s
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_executable (convertis, x86_64-unknown-linux-gnu) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-gnu, deb-gnu) (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, deb-musl) (push) Has been skipped
Release / build_package (x86_64-unknown-linux-musl, rpm-musl) (push) Has been skipped
CI / Test (push) Successful in 1m17s
CI / Build Linux (push) Successful in 1m31s
167 lines
5.5 KiB
YAML
167 lines
5.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
check-release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
match: ${{ steps.check.outputs.match }}
|
|
version: ${{ steps.check.outputs.version }}
|
|
steps:
|
|
- name: Check commit message
|
|
id: check
|
|
run: |
|
|
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
|
if echo "$COMMIT_MSG" | grep -Eq 'Release [vV]?[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
VERSION=$(echo "$COMMIT_MSG" | grep -Eo 'Release [vV]?[0-9]+\.[0-9]+\.[0-9]+' | head -n1 | sed -E 's/Release //')
|
|
echo "match=true" >> $GITHUB_OUTPUT
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "match=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
build_executable:
|
|
needs: check-release
|
|
if: needs.check-release.outputs.match == 'true'
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- 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 --target ${{ matrix.target }}
|
|
|
|
- name: Upload Executable Artifact
|
|
uses: actions/upload-artifact@v3
|
|
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@v3
|
|
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@v3
|
|
with:
|
|
name: pkg-${{ matrix.type }}
|
|
path: dist/*
|
|
|
|
publish-release:
|
|
needs: [check-release, build_package]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download All Packages
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: all-packages/
|
|
|
|
- name: Generate Changelog
|
|
run: |
|
|
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || git rev-list --max-parents=0 HEAD)
|
|
git log ${LAST_TAG}..HEAD --pretty=format:"- %s (%an)" > commits.txt
|
|
|
|
echo "## Changelog" > changelog.md
|
|
|
|
echo "### Features" >> changelog.md
|
|
grep -i "^- feat:" commits.txt >> changelog.md || echo "No new features" >> changelog.md
|
|
|
|
echo "### Fixes" >> changelog.md
|
|
grep -i "^- fix:" commits.txt >> changelog.md || echo "No fixes" >> changelog.md
|
|
|
|
echo "### Refactoring & Chores" >> changelog.md
|
|
grep -i "^- refactor:\|^- chore:\|^- style:" commits.txt >> changelog.md || echo "No refactoring or chores" >> changelog.md
|
|
|
|
echo "### Others" >> changelog.md
|
|
grep -vi "^- feat:\|^- fix:\|^- refactor:\|^- chore:\|^- style:" commits.txt >> changelog.md || echo "No other changes" >> changelog.md
|
|
|
|
- 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/pkg-*/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |