Bunch of changes, like a lot

This commit is contained in:
Elias Wendland
2026-07-17 18:58:52 +02:00
parent f07f54d4c1
commit 3297f60f00
25 changed files with 566 additions and 285 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
lfs: true
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --workspace --locked
- run: cargo build --release --workspace --locked --target x86_64-unknown-linux-gnu
- run: cargo build --release --package convertis --locked --target x86_64-unknown-linux-gnu
- name: Verify plugin-free recommendation
run: |
test_dir=$(mktemp -d)
+120
View File
@@ -0,0 +1,120 @@
name: Plugin Releases
on:
push:
branches: ["main"]
paths:
- "plugins/**"
env:
CARGO_TERM_COLOR: always
jobs:
detect:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.plugins.outputs.matrix }}
count: ${{ steps.plugins.outputs.count }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Install discovery tools
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Discover changed plugins
id: plugins
env:
BEFORE: ${{ gitea.event.before }}
AFTER: ${{ gitea.sha }}
run: |
matrix=$(packaging/changed-plugins.sh "$BEFORE" "$AFTER")
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
echo "count=$(jq '.include | length' <<<"$matrix")" >> "$GITHUB_OUTPUT"
build-package-publish:
needs: detect
if: needs.detect.outputs.count != '0'
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.detect.outputs.matrix) }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- name: Test plugin
env:
CONVERTIS_ENGINE_VERSION: ${{ matrix.engine_version }}
run: cargo test --locked --manifest-path "${{ matrix.manifest }}"
- name: Build plugin
env:
CONVERTIS_ENGINE_VERSION: ${{ matrix.engine_version }}
run: cargo build --release --locked --manifest-path "${{ matrix.manifest }}" --target x86_64-unknown-linux-gnu
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Install packaging tools
run: |
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.47.0
sudo apt-get update
sudo apt-get install -y rpm
- name: Build plugin packages
run: |
export PATH="$HOME/go/bin:$PATH"
packaging/build-plugin-package.sh deb "${{ matrix.manifest }}" target/x86_64-unknown-linux-gnu/release dist
packaging/build-plugin-package.sh rpm "${{ matrix.manifest }}" target/x86_64-unknown-linux-gnu/release dist
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Sign and verify RPM
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
passphrase_file=$(mktemp)
public_key_file=$(mktemp)
trap 'rm -f "$passphrase_file" "$public_key_file"' EXIT
printf '%s' "$GPG_PASSPHRASE" > "$passphrase_file"
chmod 600 "$passphrase_file"
echo "%_signature gpg" > ~/.rpmmacros
echo "%_gpg_name ${{ steps.import-gpg.outputs.keyid }}" >> ~/.rpmmacros
echo "%_gpg_path $HOME/.gnupg" >> ~/.rpmmacros
echo "%_gpg_passphrase_file $passphrase_file" >> ~/.rpmmacros
echo '%__gpg_sign_cmd /usr/bin/gpg --batch --yes --pinentry-mode loopback --passphrase-file %{_gpg_passphrase_file} --no-verbose --no-armor --no-secmem-warning -u %{_gpg_name} -sbo %{__signature_filename} -- %{__plaintext_filename}' >> ~/.rpmmacros
rpm --addsign dist/*.rpm
gpg --armor --export "${{ steps.import-gpg.outputs.keyid }}" > "$public_key_file"
sudo rpm --import "$public_key_file"
rpm --checksig --verbose dist/*.rpm | grep -Eq '[Ss]ignature.*: OK'
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.package }}-${{ matrix.version }}
if-no-files-found: error
path: |
target/x86_64-unknown-linux-gnu/release/${{ matrix.library }}
dist/*
- name: Publish plugin packages to Gitea
env:
GITEA_URL: ${{ gitea.server_url }}
GITEA_OWNER: ${{ gitea.repository_owner }}
TOKEN: ${{ secrets.PACKAGE_PAT }}
run: |
for package in dist/*.rpm; do
code=$(curl -sS -w '%{http_code}' -o /dev/null -u "${{ gitea.actor }}:$TOKEN" --upload-file "$package" "$GITEA_URL/api/packages/$GITEA_OWNER/rpm/upload")
test "$code" = 201 || test "$code" = 409
done
for package in dist/*.deb; do
code=$(curl -sS -w '%{http_code}' -o /dev/null -u "${{ gitea.actor }}:$TOKEN" --upload-file "$package" "$GITEA_URL/api/packages/$GITEA_OWNER/debian/pool/debian/main/upload")
test "$code" = 201 || test "$code" = 409
done
+13 -14
View File
@@ -12,15 +12,19 @@ jobs:
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Check release commit and version
with:
fetch-depth: 0
- name: Check for a new stable engine version
id: check
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
BEFORE: ${{ gitea.event.before }}
run: |
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 [vV]?//')
package_version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n1)
test "$version" = "$package_version"
version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' Cargo.toml | head -n1)
previous=""
if [[ -n "$BEFORE" ]] && git cat-file -e "$BEFORE:Cargo.toml" 2>/dev/null; then
previous=$(git show "$BEFORE:Cargo.toml" | sed -n 's/^version = "\([^"]*\)"/\1/p' | head -n1)
fi
if [[ -n "$version" && "$version" != *-dev* && "$version" != "$previous" ]]; then
echo "match=true" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
else
@@ -37,15 +41,14 @@ jobs:
with:
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace --locked
- run: cargo build --release --workspace --locked --target x86_64-unknown-linux-gnu
- run: cargo test --package convertis --locked
- run: cargo build --release --package convertis --locked --target x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v3
with:
name: build-linux
if-no-files-found: error
path: |
target/x86_64-unknown-linux-gnu/release/convertis
target/x86_64-unknown-linux-gnu/release/libconvertis_*.so
target/man/convertis.1
package:
@@ -123,12 +126,9 @@ jobs:
merge-multiple: false
- name: Prepare release assets
run: |
mkdir -p release-assets/plugins
mkdir -p release-assets
binary=$(find all-artifacts/build-linux -type f -name convertis | head -n1)
cp "$binary" release-assets/convertis-x86_64-unknown-linux-gnu
find all-artifacts/build-linux -type f -name 'libconvertis_*.so' -exec cp {} release-assets/plugins/ \;
cd release-assets
zip -r "convertis-plugins-${{ needs.check-release.outputs.version }}-x86_64-unknown-linux-gnu.zip" plugins
- name: Generate changelog
run: |
last_tag=$(git describe --tags --abbrev=0 2>/dev/null || git rev-list --max-parents=0 HEAD)
@@ -141,7 +141,6 @@ jobs:
body_path: changelog.md
files: |
release-assets/convertis-x86_64-unknown-linux-gnu
release-assets/convertis-plugins-${{ needs.check-release.outputs.version }}-x86_64-unknown-linux-gnu.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish packages to Gitea registries