-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (58 loc) · 1.65 KB
/
build.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
59
60
61
62
63
64
65
66
name: Build
on:
push:
branches:
- main
tags:
- "*"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.18
id: go
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
env:
CGO_ENABLED: 0
run: go build -v
- name: Run Tests
run: |
bash ./test.sh
# note: codecov action is disallowed per organization policy
# - name: Upload to codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.txt
# fail_ci_if_error: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Latest
if: github.ref == 'refs/heads/main'
run: |
docker build . -t ghcr.io/coveooss/credentials-sync:latest
docker push ghcr.io/coveooss/credentials-sync:latest
- name: Build Tag
if: github.ref != 'refs/heads/main'
run: |
export tag=$(cut -d'/' -f3 <<<'${{ github.ref }}')
docker build . -t ghcr.io/coveooss/credentials-sync:$tag
docker push ghcr.io/coveooss/credentials-sync:$tag
- name: Push release
if: github.ref != 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -sL https://git.io/goreleaser | bash;