diff --git a/.github/workflows/publish-snap.yml b/.github/workflows/publish-snap.yml index cd8e5a14..482e8e39 100644 --- a/.github/workflows/publish-snap.yml +++ b/.github/workflows/publish-snap.yml @@ -3,7 +3,7 @@ name: Publish Snap on: push: branches: [master, beta, nightly] - #tags: [v*] + tags: [v*] pull_request: ~ jobs: @@ -28,10 +28,10 @@ jobs: id: prepare run: | git fetch --prune --unshallow --tags - if [[ $GITHUB_REF == refs/heads/master ]]; then - echo ::set-output name=RELEASE::stable - elif [[ $GITHUB_REF == refs/heads/beta ]]; then + if [[ $GITHUB_REF == refs/tags/*-beta || $GITHUB_REF == refs/heads/beta ]]; then echo ::set-output name=RELEASE::beta + elif [[ $GITHUB_REF == refs/tags/* || $GITHUB_REF == refs/heads/master ]]; then + echo ::set-output name=RELEASE::stable else echo ::set-output name=RELEASE::edge fi @@ -58,7 +58,9 @@ jobs: - name: Publish Snap Package uses: snapcore/action-publish@v1 - if: github.event_name != 'pull_request' + if: > + github.event_name != 'pull_request' && + (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/nightly') with: store_login: ${{ secrets.SNAP_LOGIN }} snap: ${{ steps.build.outputs.snap }} diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d2cb7a54..432b79bf 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,6 +37,11 @@ parts: else GRADE=stable fi + if [ "$VERSION" = "$TAG" ] && [ ! "$VERSION" = "${VERSION%-beta}" ]; then + BRANCH=beta + elif [ "$VERSION" = "$TAG" ]; then + BRANCH=master + fi echo $BRANCH > branch.txt echo $COMMIT > version.txt snapcraftctl set-version "$VERSION"