-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (63 loc) · 2.22 KB
/
publish-snaps.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: publish-snaps
on:
workflow_dispatch:
inputs:
coder_version:
description: "Coder version"
required: true
release_channel:
description: "Release channel"
required: true
type: choice
options:
- stable
- mainline
repository_dispatch:
types: [coder-release]
jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
name: publish-snaps
strategy:
matrix:
os:
- depot-ubuntu-22.04
- depot-ubuntu-22.04-arm
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set metadata
id: metadata
run: |
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
echo "coder_version=${{ github.event.client_payload.coder_version }}" >> "$GITHUB_OUTPUT"
if [[ "${{ github.event.client_payload.release_channel }}" == "stable" ]]; then
echo "release_channel=stable" >> "$GITHUB_OUTPUT"
else
echo "release_channel=candidate" >> "$GITHUB_OUTPUT"
fi
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "coder_version=${{ github.event.inputs.coder_version }}" >> "$GITHUB_OUTPUT"
if [[ "${{ github.event.inputs.release_channel }}" == "stable" ]]; then
echo "release_channel=stable" >> "$GITHUB_OUTPUT"
else
echo "release_channel=candidate" >> "$GITHUB_OUTPUT"
fi
else
echo "Unknown event: ${{ github.event_name }}"
exit 1
fi
- name: Set version in snapcraft.yaml
run: |
sed -i "s/version: \".*\"/version: \"${{ steps.metadata.outputs.coder_version }}\"/" snap/snapcraft.yaml
git diff snap/snapcraft.yaml
- uses: snapcore/action-build@v1
id: build
if: ${{ steps.metadata.outputs.release_channel == 'mainline' }}
- uses: snapcore/action-publish@v1
if: ${{ steps.metadata.outputs.release_channel == 'mainline' }}
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: stable