Release / check-release (push) Successful in 27s
Release / package_gnu (deb) (push) Canceled after 0s
Release / package_gnu (rpm) (push) Canceled after 0s
Release / package_musl (deb) (push) Canceled after 0s
Release / package_musl (rpm) (push) Canceled after 0s
Release / publish-release (push) Canceled after 0s
Release / build_windows (push) Canceled after 1m14s
Release / build_gnu (push) Canceled after 1m15s
Release / build_musl (push) Canceled after 1m14s
CI / Test (push) Canceled after 1m57s
CI / Build Linux (push) Canceled after 1m57s
242 lines
7.8 KiB
YAML
242 lines
7.8 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_gnu:
|
|
needs: check-release
|
|
if: needs.check-release.outputs.match == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-unknown-linux-gnu
|
|
- name: Build
|
|
run: cargo build --release --target x86_64-unknown-linux-gnu
|
|
|
|
- name: Rename Raw Executable
|
|
run: cp target/x86_64-unknown-linux-gnu/release/convertis convertis-x86_64-unknown-linux-gnu
|
|
|
|
- name: Upload Binary for Packaging
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-gnu
|
|
path: target/x86_64-unknown-linux-gnu/release/convertis
|
|
|
|
- name: Upload Raw Executable Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: raw-gnu
|
|
path: convertis-x86_64-unknown-linux-gnu
|
|
|
|
build_musl:
|
|
needs: check-release
|
|
if: needs.check-release.outputs.match == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-unknown-linux-musl
|
|
- name: Install cross-platform linkers
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y musl-tools
|
|
- name: Build
|
|
run: cargo build --release --target x86_64-unknown-linux-musl
|
|
|
|
- name: Rename Raw Executable
|
|
run: cp target/x86_64-unknown-linux-musl/release/convertis convertis-x86_64-unknown-linux-musl
|
|
|
|
- name: Upload Binary for Packaging
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-musl
|
|
path: target/x86_64-unknown-linux-musl/release/convertis
|
|
|
|
- name: Upload Raw Executable Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: raw-musl
|
|
path: convertis-x86_64-unknown-linux-musl
|
|
|
|
build_windows:
|
|
needs: check-release
|
|
if: needs.check-release.outputs.match == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-pc-windows-gnu
|
|
- name: Install cross-platform linkers
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y mingw-w64
|
|
- name: Build
|
|
run: cargo build --release --target x86_64-pc-windows-gnu
|
|
|
|
- name: Upload Raw Executable Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: raw-windows
|
|
path: target/x86_64-pc-windows-gnu/release/convertis.exe
|
|
|
|
package_gnu:
|
|
needs: [check-release, build_gnu]
|
|
if: needs.check-release.outputs.match == 'true'
|
|
strategy:
|
|
matrix:
|
|
type: [deb, rpm]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Download compiled binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-gnu
|
|
path: target/x86_64-unknown-linux-gnu/release/
|
|
merge-multiple: false
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
if [ "${{ matrix.type }}" = "deb" ]; then
|
|
cargo install cargo-deb
|
|
elif [ "${{ matrix.type }}" = "rpm" ]; then
|
|
cargo install cargo-generate-rpm
|
|
fi
|
|
|
|
- name: Build package
|
|
run: |
|
|
mkdir -p dist/
|
|
if [ "${{ matrix.type }}" = "deb" ]; then
|
|
cargo deb --no-build --target x86_64-unknown-linux-gnu
|
|
cp target/x86_64-unknown-linux-gnu/debian/*.deb dist/
|
|
elif [ "${{ matrix.type }}" = "rpm" ]; then
|
|
cargo generate-rpm --target-dir target/x86_64-unknown-linux-gnu
|
|
cp target/x86_64-unknown-linux-gnu/generate-rpm/*.rpm dist/
|
|
fi
|
|
|
|
- name: Upload Package Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: pkg-${{ matrix.type }}-gnu
|
|
path: dist/*
|
|
|
|
package_musl:
|
|
needs: [check-release, build_musl]
|
|
if: needs.check-release.outputs.match == 'true'
|
|
strategy:
|
|
matrix:
|
|
type: [deb, rpm]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Download compiled binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: build-musl
|
|
path: target/x86_64-unknown-linux-musl/release/
|
|
merge-multiple: false
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
if [ "${{ matrix.type }}" = "deb" ]; then
|
|
cargo install cargo-deb
|
|
elif [ "${{ matrix.type }}" = "rpm" ]; then
|
|
cargo install cargo-generate-rpm
|
|
fi
|
|
|
|
- name: Build package
|
|
run: |
|
|
mkdir -p dist/
|
|
if [ "${{ matrix.type }}" = "deb" ]; then
|
|
cargo deb --no-build --target x86_64-unknown-linux-musl
|
|
cp target/x86_64-unknown-linux-musl/debian/*.deb dist/
|
|
elif [ "${{ matrix.type }}" = "rpm" ]; then
|
|
cargo generate-rpm --target-dir target/x86_64-unknown-linux-musl
|
|
cp target/x86_64-unknown-linux-musl/generate-rpm/*.rpm dist/
|
|
fi
|
|
|
|
- name: Upload Package Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: pkg-${{ matrix.type }}-musl
|
|
path: dist/*
|
|
|
|
publish-release:
|
|
needs: [check-release, build_windows, package_gnu, package_musl]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download All Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: all-packages/
|
|
merge-multiple: false
|
|
|
|
- name: Cleanup internal build artifacts
|
|
run: |
|
|
rm -rf all-packages/build-gnu
|
|
rm -rf all-packages/build-musl
|
|
|
|
- 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/**/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |