Merge pull request #74 from hector-cao/dev-fix-failing-test #99
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Do a snap build and push to store | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '**.md' # Don't trigger if doc updated | |
tags: | |
- "v*" | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
check-secret: | |
runs-on: ubuntu-22.04 | |
outputs: | |
snap-key: ${{ steps.snap-key.outputs.defined }} | |
steps: | |
- id: snap-key | |
name: Set defined=true if STORE_LOGIN is defined | |
if: "${{ env.SNAPSTORE_KEY != '' }}" | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
env: | |
SNAPSTORE_KEY: ${{ secrets.STORE_LOGIN }} | |
build-and-publish: | |
runs-on: ubuntu-22.04 | |
needs: [check-secret] | |
steps: | |
- if: needs.check-secret.outputs.snap-key == 'true' | |
name : Remove Docker | |
run: | | |
# https://github.com/canonical/lxd-cloud/blob/f20a64a8af42485440dcbfd370faf14137d2f349/test/includes/lxd.sh#L13-L23 | |
sudo rm -rf /etc/docker | |
sudo apt-get purge moby-buildx moby-engine moby-cli moby-compose moby-containerd moby-runc -y | |
sudo iptables -P FORWARD ACCEPT | |
- if: needs.check-secret.outputs.snap-key == 'true' | |
name: Checkout checkbox-kivu | |
uses: actions/checkout@v3 | |
with: | |
# Fetch all of history so DM can determine its own version from git. | |
fetch-depth: 0 | |
- if: needs.check-secret.outputs.snap-key == 'true' | |
uses: snapcore/[email protected] | |
name: Build checkbox-kivu-classic snap | |
id: build | |
with: | |
snapcraft-channel: latest/stable | |
- if: needs.check-secret.outputs.snap-key == 'true' | |
name: Verify checkbox-kivu-classic snap | |
run: | | |
# Make sure it is installable. | |
sudo snap install checkbox22 | |
sudo snap install --dangerous --classic ${{ steps.build.outputs.snap }} | |
- if: needs.check-secret.outputs.snap-key == 'true' && !startsWith(github.event.ref, 'refs/tags/v') | |
name: Publish snap edge release | |
uses: snapcore/[email protected] | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | |
with: | |
snap: ${{ steps.build.outputs.snap }} | |
release: edge | |
- if: needs.check-secret.outputs.snap-key == 'true' && startsWith(github.event.ref, 'refs/tags/v') | |
name: Publish snap beta release | |
uses: snapcore/[email protected] | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | |
with: | |
snap: ${{ steps.build.outputs.snap }} | |
release: beta | |