-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 1.71 KB
/
main.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Main branch workflow
on:
push:
pull_request:
branches:
- main
jobs:
build:
name: Build snap
runs-on: ubuntu-20.04
outputs:
snap: ${{ steps.snapcraft.outputs.snap }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build snap locally
uses: snapcore/action-build@v1.3.0
id: snapcraft
- name: Upload locally built snap artifact
uses: actions/upload-artifact@v4
with:
name: snap
path: ${{ steps.snapcraft.outputs.snap }}
publish:
name: Snap publish
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4
- name: Downloads locally built snap artifact
uses: actions/download-artifact@v4
id: download
with:
name: snap
- name: Determine snap file name
id: find-snap
run: |
SNAP_FILE=$(ls *.snap)
echo "Found snap file: $SNAP_FILE"
echo "snap_file=${SNAP_FILE}" >>$GITHUB_OUTPUT
- name: Publish snap
uses: snapcore/action-publish@v1.2.0
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
if: ${{ github.ref_name == 'main' }}
with:
snap: ${{ steps.find-snap.outputs.snap_file }}
release: 1.5/edge
- name: Publish developer snap to branch
uses: snapcore/action-publish@v1.2.0
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
if: ${{ (github.ref_name != 'main') && (github.event_name == 'push') }}
with:
snap: ${{ steps.find-snap.outputs.snap_file }}
release: 1.5/edge/${{ github.ref_name }}