-
Notifications
You must be signed in to change notification settings - Fork 18
58 lines (53 loc) · 1.59 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
name: Build, test and release snap
on:
workflow_call:
inputs:
tag:
type: string
required: true
secrets:
snapcraft-credential:
required: true
github-token:
required: true
workflow_dispatch:
# this trigger uses existing version for release
jobs:
prereqs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps._id.outputs.version }}
steps:
- uses: actions/checkout@v3
if: github.event_name == 'workflow_dispatch'
- shell: bash
id: _id
run: |
tag=
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
tag="$(awk -F: '/^version:/ {print $2}' snap/snapcraft.yaml | tr -d '[:space:]')"
else
tag="${{inputs.tag}}"
fi
echo "tag: $tag"
echo "version=$tag" >> $GITHUB_OUTPUT
build-and-test:
needs: [ prereqs ]
uses: RocketChat/server-snap/.github/workflows/test.yml@develop
with:
tag: ${{ needs.prereqs.outputs.version }}
secrets:
snapcraft-credential: ${{ secrets.snapcraft-credential }}
release:
if: '! contains(inputs.tag, ''rc'')'
needs:
- build-and-test
uses: RocketChat/server-snap/.github/workflows/release.yml@develop
with:
snap: ${{ needs.build-and-test.outputs.snap-basename }}
snap-track: ${{ needs.build-and-test.outputs.snap-track }}
commit: ${{ needs.build-and-test.outputs.commit }}
tag: ${{ inputs.tag }}
secrets:
snapcraft-credential: ${{ secrets.snapcraft-credential }}
github-token: ${{ secrets.github-token }}