Skip to content

Commit

Permalink
fix(snap): ensure snaps are from current run (#338)
Browse files Browse the repository at this point in the history
The GitHub actions used to download the
snap artifacts was pulling the snaps
from the previous workflow run instead
of the current one. This commit changes
the GitHub action and pulls all the snaps
at the same time.
  • Loading branch information
cjdcordeiro authored Nov 30, 2023
1 parent f141ee1 commit 91bba67
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: true
matrix:
arch: ["amd64","arm64","ppc64el","armhf","s390x"]
arch: ["amd64", "arm64", "ppc64el", "armhf", "s390x"]
steps:
- name: Checkout Pebble repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -103,12 +103,7 @@ jobs:
(needs.local-build.result == 'success' || needs.local-build.result == 'skipped') &&
(needs.remote-build.result == 'success' || needs.remote-build.result == 'skipped')
steps:
- name: Download ${{ env.SNAP_NAME }} snap for ${{ env.TEST_ON }}
id: download-snap
uses: dawidd6/action-download-artifact@v2
with:
name: "${{ env.SNAP_NAME }}.*${{ env.TEST_ON }}.*snap"
name_is_regexp: true
- uses: actions/download-artifact@v3

- id: get-snap
run: echo "filename=$(find ${{ env.SNAP_NAME }}*${{ env.TEST_ON }}*snap/*)" >> $GITHUB_OUTPUT
Expand All @@ -120,7 +115,7 @@ jobs:
# Make sure it is installed
pebble version --client
# Run smoke test
pebble enter --create-dirs exec echo Hello | grep Hello
Expand All @@ -131,19 +126,14 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: ["amd64","arm64","ppc64el","armhf","s390x"]
arch: ["amd64", "arm64", "ppc64el", "armhf", "s390x"]
steps:
- name: Download ${{ env.SNAP_NAME }} snap for ${{ matrix.arch }}
id: download-snap
uses: dawidd6/action-download-artifact@v2
with:
name: "${{ env.SNAP_NAME }}.*${{ matrix.arch }}.*snap"
name_is_regexp: true

- uses: actions/download-artifact@v3

- id: get-snap
run: echo "filename=$(find ${{ env.SNAP_NAME }}*${{ matrix.arch }}*snap/*)" >> $GITHUB_OUTPUT

- name: Release ${{ steps.get-snap.outputs.filename }} to ${{ env.DEFAULT_TRACK }}/${{ env.DEFAULT_RISK }}
- name: Release ${{ steps.get-snap.outputs.filename }} to ${{ env.DEFAULT_TRACK }}/${{ env.DEFAULT_RISK }}
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
Expand Down Expand Up @@ -177,7 +167,7 @@ jobs:
echo "revision=$revision" >> $GITHUB_OUTPUT
# It would be easier to use `snapcraft promote`, but there's an error when trying
# to avoid the prompt with the "--yes" option:
# to avoid the prompt with the "--yes" option:
# > 'latest/edge' is not a valid set value for --from-channel when using --yes.
- name: Promote ${{ env.SNAP_NAME }} snap rev${{ steps.get-snap.outputs.revision }} to ${{ env.TO_TRACK }}/${{ env.TO_RISK }}
env:
Expand Down

0 comments on commit 91bba67

Please sign in to comment.