-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (49 loc) · 1.4 KB
/
build.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
name: Build And Test
on:
push: {}
env:
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.TRUSS_AWS_ACCESS_KEY_ID }}
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.TRUSS_AWS_SECRET_ACCESS_KEY }}
ECR_AWS_DEFAULT_REGION: us-east-2
jobs:
build:
runs-on: ubuntu-latest
steps:
# general setup
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch everything for gorelease
- name: Checkout Bridge Actions
uses: actions/checkout@v3
with:
repository: get-bridge/actions
token: ${{ secrets.GIT_HUB_TOKEN }}
path: .github/actions
- name: ECR Auth
uses: ./.github/actions/ecr-auth
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
# build image
- name: Docker Build
run: |
docker build \
--tag $ECR_REGISTRY/muss:$GITHUB_SHA \
--tag $ECR_REGISTRY/muss:latest \
.
# build and test golang
- name: GoReleaser Build
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: build --snapshot
- name: Test
run: make test
# push image
- name: Docker Push
if: ${{ github.ref == 'refs/heads/master' }}
run: |
docker push $ECR_REGISTRY/muss:$GITHUB_SHA
docker push $ECR_REGISTRY/muss:latest