ci(snap): enable snapcraft build across platforms

This commit is contained in:
Jon Seager 2025-01-11 09:33:11 +00:00
parent 0bd5d2fe9e
commit 2e49ba1add
No known key found for this signature in database

View file

@ -145,12 +145,11 @@ jobs:
path: yazi-${{ matrix.target }}.zip
build-snap:
if: false # Can't make CI pass, disable for now
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch:
- amd64
- arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@ -158,8 +157,32 @@ jobs:
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Build
uses: snapcore/action-build@v1
- name: Setup LXD
uses: canonical/setup-lxd@v1
- name: Setup snapcraft
run: |
sudo snap install --classic snapcraft
mkdir -p ~/.local/share/snapcraft
echo "${{ secrets.LP_TOKEN }}" > ~/.local/share/snapcraft/launchpad-credentials
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "Github Actions"
- name: Build snap
env:
arch: ${{ matrix.arch }}
run: |
# Modify the `platforms` to use a single arch only, but run this in a matrix so they
# all get hit
yq -i '.platforms |= {env(arch): {"build-on": env(arch)}}' snap/snapcraft.yaml
# Now run a remote-build, targeting just the single arch specified
snapcraft remote-build --launchpad-accept-public-upload
# Output the build logs from the remote-build
cat snapcraft-${name}*${arch}*.txt || echo "Could not find build log"
- name: Rename snap
run: mv yazi_*.snap yazi-${{ matrix.target }}.snap