Skip to content

feat: drag knife and tangential knife cutting support #1736

feat: drag knife and tangential knife cutting support

feat: drag knife and tangential knife cutting support #1736

Workflow file for this run

name: Publish .deb to PPA
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
branches:
- "*"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint-test:
if: github.repository == 'barebaric/rayforge'
uses: ./.github/workflows/lint-test.yml
publish-to-ppa:
name: Build and Publish to PPA for ${{ matrix.distro.name }}
needs: [lint-test]
outputs:
deb_filename: ${{ steps.build_test_packages.outputs.deb_filename }}
# Define a build matrix for different Ubuntu versions
strategy:
matrix:
distro:
- { name: "Ubuntu 24.04", codename: "noble", runner: "ubuntu-24.04" }
runs-on: ${{ matrix.distro.runner }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
- name: Install build dependencies
run: >
sudo apt-get update && sudo apt-get install -y
build-essential
cargo
cython3
devscripts
debhelper
dh-python
dput
equivs
jq
python3-all
python3-maturin
python3-numpy
pybuild-plugin-pyproject
python3-pip
python3-poetry-core
python3-pyclipper
cython3
pkg-config
rustc
- name: Import GPG key
# Run on tags OR main branch push
if: github.repository == 'barebaric/rayforge' && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
env:
GPG_PASSPHRASE: ${{ secrets.PPA_GPG_PASSPHRASE }}
GPG_PRIVATE_KEY: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
run: |
echo "$GPG_PASSPHRASE" | gpg --batch --yes --pinentry-mode=loopback --passphrase-fd 0 --import <(echo "$GPG_PRIVATE_KEY" | base64 --decode)
KEY_FINGERPRINT=$(gpg --list-secret-keys --with-colons | grep '^fpr' | head -n 1 | awk -F: '{print $10}')
if [ -z "$KEY_FINGERPRINT" ]; then
echo "::error::Could not extract GPG key fingerprint."
exit 1
fi
echo "Found key fingerprint: $KEY_FINGERPRINT"
echo "KEY_ID=$KEY_FINGERPRINT" >> $GITHUB_ENV
- name: Build Packages for Testing
id: build_test_packages
env:
TARGET_DISTRIBUTION: ${{ matrix.distro.codename }}
run: |
chmod +x ./scripts/build-deb.sh
./scripts/build-deb.sh --source
DEB_FILE_PATH=$(find dist -name "*.deb" -type f | head -n 1)
if [ -z "$DEB_FILE_PATH" ]; then
echo "::error::Build failed, no .deb file found in dist/ directory."
exit 1
fi
DEB_FILENAME=$(basename "$DEB_FILE_PATH")
echo "deb_file_path=$DEB_FILE_PATH" >> $GITHUB_OUTPUT
echo "deb_filename=$DEB_FILENAME" >> $GITHUB_OUTPUT
- name: Install runtime dependencies for testing
run: |
sudo mk-build-deps --install --tool="apt-get -y" debian/control
- name: Test package installation
run: |
sudo apt-get install -y ./${{ steps.build_test_packages.outputs.deb_file_path }}
- name: Run smoke test
run: |
# Verify that the package is listed as installed
dpkg -l rayforge
# Verify the main executable is in the PATH and can be run
# This simple command proves the installation was successful.
rayforge --version
# Try running the app and immediately exiting again.
sudo apt-get install -y xvfb
xvfb-run rayforge --exit
- name: Sign source package
id: sign_source_package
# Trigger on tags OR main branch push
if: github.repository == 'barebaric/rayforge' && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main')
env:
GPG_PASSPHRASE: ${{ secrets.PPA_GPG_PASSPHRASE }}
KEY_ID: ${{ env.KEY_ID }}
run: |
# Retrieve the _source.changes generated by build-deb.sh
CHANGES_FILE=$(find dist -name "*_source.changes" -type f | head -n 1)
if [ -z "$CHANGES_FILE" ]; then
echo "::error::Source changes file not found in dist/."
exit 1
fi
echo "Signing $CHANGES_FILE..."
echo "$GPG_PASSPHRASE" > /tmp/passphrase.txt
debsign -p"gpg --batch --yes --pinentry-mode loopback --passphrase-file /tmp/passphrase.txt" -k"$KEY_ID" "$CHANGES_FILE"
rm /tmp/passphrase.txt
echo "changes_file_path=$CHANGES_FILE" >> $GITHUB_OUTPUT
- name: Upload Binary Artifact for Release
uses: actions/upload-artifact@v7
with:
name: ${{ steps.build_test_packages.outputs.deb_filename }}
path: ${{ steps.build_test_packages.outputs.deb_file_path }}
- name: Upload to PPA
# Trigger on tags OR main branch push
if: github.repository == 'barebaric/rayforge' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, '-')
run: |
CHANGES_FILE=${{ steps.sign_source_package.outputs.changes_file_path }}
echo "Uploading $CHANGES_FILE to PPA..."
dput ppa:knipknap/rayforge "$CHANGES_FILE"
release:
name: Attach .deb to GitHub Release
needs: [publish-to-ppa]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'barebaric/rayforge'
permissions:
contents: write
steps:
- name: Determine release type
id: release_info
shell: bash
run: |
TAG="${{ github.ref_name }}"
if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+- ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Download .deb artifact
uses: actions/download-artifact@v8
with:
name: ${{ needs.publish-to-ppa.outputs.deb_filename }}
- name: Attach .deb to GitHub Release
uses: softprops/action-gh-release@v3
with:
files: ${{ needs.publish-to-ppa.outputs.deb_filename }}
draft: false
prerelease: ${{ steps.release_info.outputs.is_prerelease }}
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}