-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (119 loc) · 3.63 KB
/
commands.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: commands
run-name: Issue comment
on:
issue_comment:
types:
- created
jobs:
build:
if: ${{ contains(github.event.comment.body, '/rebuild') }}
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: kaisugi/[email protected]
with:
text: ${{ github.event.comment.body }}
regex: '^/rebuild(\+[a-z]*)?\s*([\w\.]+)$'
id: command_regex
- uses: kaisugi/[email protected]
with:
text: ${{ steps.regex.outputs.group2 }}
regex: '^[\d\.]+-?(beta|)([\d\.]+)?snap\d+$'
id: tag_regex
- uses: actions/checkout@v4
- uses: ./.github/actions/build
with:
ref: ${{ steps.command_regex.outputs.group2 }}
id: build
- run: echo "${{ matrix.arch }}=${{ steps.build.outputs.snap }}" >> $GITHUB_OUTPUT
id: snap
- run: gh issue comment "${{ github.event.issue.number }}" --body "Rebuild completed successfully for ${{ steps.command_regex.outputs.group2 }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
outputs:
amd64: ${{ steps.snap.outputs.amd64 }}
command_suffix: ${{ steps.command_regex.outputs.group1 }}
tag: ${{ steps.command_regex.outputs.group2 }}
channel: ${{ steps.tag_regex.outputs.group1 }}
scan:
needs: build
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/scan
with:
snap: ${{ needs.build.outputs[matrix.arch] }}
test:
needs: build
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
snap: ${{ needs.build.outputs[matrix.arch] }}
release:
needs:
- build
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/release
with:
tag: ${{ needs.build.outputs.tag }}
channel: ${{ needs.build.outputs.channel || 'stable' }}
update: true
- run: gh issue comment "${{ github.event.issue.number }}" --body "Release files were updated for ${{ needs.build.outputs.tag }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
publish:
if: ${{ needs.build.outputs.command_suffix == '+publish' }}
needs:
- build
- test
runs-on: ${{ matrix.builder }}
strategy:
matrix:
include:
- builder: ubuntu-latest
arch: amd64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/publish
with:
snap: ${{ needs.build.outputs[matrix.arch] }}
channel: ${{ needs.build.outputs.channel || 'stable' }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
- run: gh issue comment "${{ github.event.issue.number }}" --body "Version ${{ needs.build.outputs.tag }} was published on snapcraft.io"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
failure:
if: ${{ failure() || cancelled() }}
needs:
- build
- test
- release
- publish
runs-on: ubuntu-latest
steps:
- run: gh issue comment "${{ github.event.issue.number }}" --body "Rebuilding ${{ needs.build.outputs.tag }} failed (see logs)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}