diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 065cdc3..d5b1104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,13 +94,28 @@ jobs: snap: needs: build runs-on: ubuntu-latest - outputs: - snap-file: ${{ steps.build-snap.outputs.snap }} + container: + # Official snapcraft image: an Ubuntu userland matching the snap base, + # with snapcraft preinstalled (no snapd/systemd/LXD required). + image: ghcr.io/canonical/snapcraft:8_core24 steps: + - name: Install build prerequisites + run: | + apt-get update -q + apt-get install -y -q --no-install-recommends git curl - uses: actions/checkout@v6 - - uses: snapcore/action-build@v1 - id: build-snap - - uses: actions/upload-artifact@v4 + - name: Build snap + run: | + # GitHub Actions overrides the image entrypoint (pebble), which is + # what normally puts craftctl on PATH; restore it, allow git to run + # in the checked-out tree, and provide rustup for the rust plugin. + git config --global --add safe.directory '*' + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable + export PATH="/usr/libexec/snapcraft:$HOME/.cargo/bin:$PATH" + snapcraft pack --destructive-mode + - name: Upload snap artifact + uses: actions/upload-artifact@v4 with: name: snap - path: ${{ steps.build-snap.outputs.snap }} + path: ./*.snap + if-no-files-found: error diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 3fc4503..530791f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -22,6 +22,7 @@ parts: craftctl set version=$(git rev-parse --short=11 HEAD) craftctl set grade="devel" build-packages: + - build-essential - pkg-config - libssl-dev - libgpg-error-dev