-
Notifications
You must be signed in to change notification settings - Fork 446
48 lines (42 loc) · 1.55 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: CI
on:
pull_request:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Decision to Publish
id: decisions
run: |
# Secrets cannot be used in conditionals, so this is our dance:
# https://github.com/actions/runner/issues/520
if [[ -n "${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}" ]]; then
echo PUBLISH=true >> $GITHUB_OUTPUT
else
echo PUBLISH= >> $GITHUB_OUTPUT
fi
- if: steps.decisions.outputs.PUBLISH == 'true'
name: Checkout Snapcraft
uses: actions/checkout@v3
with:
# Fetch all of history so Snapcraft can determine its own version from git.
fetch-depth: 0
- if: steps.decisions.outputs.PUBLISH == 'true'
uses: snapcore/action-build@v1
name: Build Snapcraft Snap
id: build
with:
snapcraft-channel: latest/candidate
- if: steps.decisions.outputs.PUBLISH == 'true'
name: Verify Snapcraft Snap
run: |
# Make sure it is installable.
sudo snap install --dangerous --classic ${{ steps.build.outputs.snap }}
- if: steps.decisions.outputs.PUBLISH == 'true' && github.event_name == 'pull_request'
# Use this until snapcore/action-publish#27 it is merged.
uses: sergiusens/action-publish@master
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.build.outputs.snap }}
release: edge/pr-${{ github.event.number }}