circleci: Manage the lifecycle of the snap

* Publish master snaps to edge after build.
* Publish tagged snaps to the stable channel after build.
This commit is contained in:
Mario Limonciello 2019-02-12 15:49:00 -06:00 committed by Richard Hughes
parent 1e47c7200b
commit a7bd2b9cb0

View File

@ -11,9 +11,54 @@ jobs:
- run:
name: "Build Snap"
command: snapcraft
- persist_to_workspace:
root: .
paths:
- "*.snap"
publish-edge:
docker:
- image: cibuilds/snapcraft:stable
steps:
- attach_workspace:
at: .
- run:
name: "Publish to Store"
command: |
mkdir .snapcraft
echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
snapcraft push *.snap --release edge
publish-stable:
docker:
- image: cibuilds/snapcraft:stable
steps:
- attach_workspace:
at: .
- run:
name: "Publish to Store"
command: |
mkdir .snapcraft
echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
snapcraft push *.snap --release stable
workflows:
version: 2
main:
jobs:
- build
- publish-edge:
requires:
- build
filters:
branches:
only: master
- publish-stable:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/