-
Notifications
You must be signed in to change notification settings - Fork 44
48 lines (40 loc) · 1.28 KB
/
snap.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: Snap
on:
pull_request:
push:
branches:
- "feature/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout rockcraft
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build rockcraft snap
id: build-rockcraft
uses: canonical/action-build@v1
- name: Upload rockcraft snap
uses: actions/upload-artifact@v4
with:
name: snap
path: ${{ steps.build-rockcraft.outputs.snap }}
- name: Get branch name
id: vars
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]
then
echo "branch=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
else
branch=$(echo ${GITHUB_REF#refs/*/} | sed -e 's|feature/\(.*\)|\1|')
echo "branch=$branch" >> "$GITHUB_OUTPUT"
fi
- name: Publish feature branch to edge/${{ steps.vars.outputs.branch }}
if: ${{ env.SNAPCRAFT_STORE_CREDENTIALS != '' }}
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.build-rockcraft.outputs.snap }}
release: edge/${{ steps.vars.outputs.branch }}