Skip to content

Commit

Permalink
Tidy Snapcraft workflow
Browse files Browse the repository at this point in the history
- Merge build and push jobs
- Eliminate artifact caching
- Inline release channel logic
- Filter branches with on.push rule
  • Loading branch information
maxsu authored and extraymond committed Feb 28, 2024
1 parent 8f685d9 commit ea8bf01
Showing 1 changed file with 16 additions and 41 deletions.
57 changes: 16 additions & 41 deletions .github/workflows/snapcraft.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
name: snapcraft

on: push
# This workflow publishes a snap on updates to the master and beta branch

name: snapcraft
on:
push:
branches:
- master
- beta
jobs:
build:
publish:
runs-on: ubuntu-latest
outputs:
snap-file: ${{ steps.build.outputs.snap }}
steps:
- uses: actions/checkout@v3
- uses: snapcore/action-build@v1
id: build
- uses: actions/upload-artifact@v3
with:
name: snap
path: ${{ steps.build.outputs.snap }}

push-master:
needs: build
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v3
with:
name: snap
path: .
- uses: snapcore/action-publish@master
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }}
with:
snap: ${{needs.build.outputs.snap-file}}
release: candidate
push-beta:
needs: build
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/beta'
steps:
- uses: actions/download-artifact@v3
with:
name: snap
path: .
- uses: snapcore/action-publish@master
- uses: actions/checkout@v3
- name: Build snap
uses: snapcore/action-build@v1
id: build
- name: Publish to the Snap Store
uses: snapcore/action-publish@master
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }}
with:
snap: ${{needs.build.outputs.snap-file}}
release: beta
snap: ${{ steps.build.outputs.snap }}
release: ${{ github.ref_name == 'master' && 'candidate' || 'beta' }}

0 comments on commit ea8bf01

Please sign in to comment.