-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (47 loc) · 1.49 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: Main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
GIT_AUTHOR_NAME: "Arnaud Deprez"
GIT_AUTHOR_EMAIL: "arnaudeprez@gmail.com"
GIT_COMMITTER_NAME: "Arnaud Deprez"
GIT_COMMITTER_EMAIL: "arnaudeprez@gmail.com"
GIT_COMMIT: ${{ github.sha }}
steps:
- name: Extract Branch Name in GIT_BRANCH env
run: |
echo "GITHUB_HEAD_REF=${GITHUB_HEAD_REF} & GITHUB_REF=${GITHUB_REF}"
if [ -n "$GITHUB_HEAD_REF" ]
then
echo "GIT_BRANCH=${GITHUB_HEAD_REF#refs/heads/}" >> $GITHUB_ENV
else
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Unshallow git repo
run: git fetch --prune --unshallow
- name: Build
run: make --environment-overrides test-release
- name: Test
run: make --environment-overrides test-integration
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true # optional (default = false)
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make --environment-overrides release
if: github.event_name != 'pull_request' && (env.GIT_BRANCH == 'main' || startsWith(env.GIT_BRANCH, 'release/'))