-
Notifications
You must be signed in to change notification settings - Fork 37
58 lines (50 loc) · 1.41 KB
/
main.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
name: Main
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
- name: Print Go Version
run: go version
- name: Build
run: ./build.sh
- name: Test
run: ./test.sh
- name: Compute Tag
if: |
github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/v')
id: compute_tag
run: |
tag=${GITHUB_REF#refs/tags/v}
if [ "$tag" != "$GITHUB_REF" ]; then
tag=$(echo "$tag" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
echo ::set-output name=TAG::${tag}
else
echo "unable to determine tag" >&2
exit 1
fi
- name: Pack
if: |
github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/v')
run: ./pack.sh "${{ steps.compute_tag.outputs.TAG }}"
- name: Create Release
if: |
github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
assets=()
for asset in fixuid-*-*-*.tar.gz; do
assets+=("-a" "$asset")
done
hub release create "${assets[@]}" \
-m "v${{ steps.compute_tag.outputs.TAG }}" \
"v${{ steps.compute_tag.outputs.TAG }}"