-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (64 loc) · 1.68 KB
/
push.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
67
68
69
70
name: Push
on:
push:
branches:
- 'main'
tags:
- '*'
env:
DOCKER_HOSTNAME: ghcr.io
DOCKER_USERNAME: ${{ github.actor }}
GO_VERSION: 1.19
jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- name: Verify
run: |
make verify
git diff --exit-code
test:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- name: Test
run: make test
build:
name: Build
runs-on: ubuntu-latest
needs: [verify, test]
if: ${{ github.repository_owner == 'fybrik' }}
steps:
- uses: actions/checkout@v3
# Versions are created as follows:
# - Tags starting with v will be released as what comes after `v`. (e.g. refs/tags/v1.0 -> 1.0).
# - Main branch will be released with `main` as version tag for the docker images
- id: version
name: Infer version
run: |
if [[ ${GITHUB_REF} == refs/tags/* ]] ;
then
version="${GITHUB_REF#refs/tags/v}"
elif [[ ${GITHUB_REF} == refs/heads/main ]] ;
then
version=main
fi
echo "DOCKER_TAG=${version}" >> $GITHUB_ENV
- name: Build docker image
run: make docker-build
- name: Docker push
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ env.DOCKER_USERNAME }}" --password-stdin "${{ env.DOCKER_HOSTNAME }}"
make docker-push
- run: docker images