From 686d7a0cb335a43306dd428dfc357d96dcb2995c Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Mon, 16 Dec 2024 13:07:29 -0500 Subject: [PATCH] ci: separate snap build and PR publish jobs This allows running snap tests while the store is still processing the snap to publish to a branch. --- .github/workflows/tests.yaml | 39 +++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5c80db8c1..49a446e09 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -53,27 +53,24 @@ jobs: snap: ${{ steps.snapcraft.outputs.snap }} release: edge/${{ steps.vars.outputs.branch }} - # Commented out until we can provide the necessary launchpad credentials. - # snap-remote-build: - # runs-on: ubuntu-latest - # steps: - # - name: Start installing snapcraft - # run: echo SNAP_JOB=$(sudo snap install --classic --no-wait snapcraft) >> $GITHUB_OUTPUT - # id: install - # - name: Checkout code - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - name: Remote-build snap - # id: snapcraft - # run: | - # sudo snap watch ${{ steps.install.outputs.SNAP_JOB }} - # snapcraft remote-build --launchpad-accept-public-upload - # - name: Upload snap artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: snap - # path: ./*.snap + snap-publish: + needs: [snap-build] + runs-on: self-hosted + if: ${{ github.event_name == 'pull_request' }} + steps: + - name: Download snap artifact + uses: actions/download-artifact@v4 + with: + name: snap + path: snap-artifacts + - name: Publish feature branch to edge/pr-${{ github.event.number }} + if: secrets.SNAPCRAFT_STORE_CREDENTIALS != '' + uses: canonical/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: "*.snap" + release: edge/pr-${{ github.event.number }} snap-tests: needs: [snap-build]