From 0b366b7dc0e84f45e35bcd06d5dc5f6cd38cf2fd Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Mon, 3 Mar 2025 17:06:11 +0000 Subject: [PATCH] ci: add snap publishing workflow This commit adds snap publishing and promotion to the CI process. For nightly releases, upload the built snaps to the 'latest/edge' channel, enabling users to track nightly builds with: snap install yazi --classic --channel latest/edge For draft releases, upload the built snaps to the 'latest/candidate' channel. And finally, when a release is published, promote the snaps that are in the 'latest/candidate' channel to 'latest/stable'. --- .github/workflows/draft.yml | 16 ++++++++++++++++ .github/workflows/publish.yml | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index 65b1be49..759437c3 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -187,6 +187,14 @@ jobs: with: merge-multiple: true + - name: Push snap to latest/candidate channel + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + run: | + for x in *.snap; do + snapcraft push -v --release latest/candidate $x + done + - name: Draft uses: softprops/action-gh-release@v1 with: @@ -221,6 +229,14 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git tag --force nightly && git push --force origin tag nightly + - name: Push snap to latest/edge channel + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + run: | + for x in *.snap; do + snapcraft push -v --release latest/edge $x + done + - name: Nightly uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 48d0051f..577815f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,3 +18,8 @@ jobs: identifier: sxyazi.yazi installers-regex: 'yazi-(x86_64|aarch64)-pc-windows-msvc\.zip$' token: ${{ secrets.WINGET_TOKEN }} + + - name: Promote snap to latest/stable + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + run: snapcraft promote yazi --from-channel latest/candidate --to-channel latest/stable --yes