-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 2.19 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
55
56
57
58
59
60
61
62
63
64
65
66
name: build
on: [ push, workflow_dispatch ]
env:
REGISTRY: docker.io/orsol/go-rest-service-template
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: actions/checkout@v4
- name: Build
shell: bash
run: make build
- name: Test
shell: bash
run: go test -v ./... -coverprofile="coverage.out"
- name: Init vars
id: vars_step
uses: ./.github/actions/git-vars
- name: Login to Docker registry
shell: bash
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
buildah login \
--username $DOCKERHUB_USERNAME \
--password $DOCKERHUB_TOKEN \
$REGISTRY
# publish image with application with three tags `latest`, commit-sha and branch with build number
- name: OCI build and push
shell: bash
run: |
buildah bud --pull -t $REGISTRY\:${{ steps.vars_step.outputs.sha-short }} \
-t $REGISTRY\:${{ steps.vars_step.outputs.branch }}-${{ github.run_number }} \
-t $REGISTRY\:latest . && \
buildah push $REGISTRY\:${{ steps.vars_step.outputs.branch }}-${{ github.run_number }} && \
buildah push $REGISTRY\:${{ steps.vars_step.outputs.sha-short }}
buildah push $REGISTRY\:latest
# Service test image is published to the same repository but `-test` prefix added to tags.
# That way it's easier to run it in kubernetes
- name: OCI Push Integration Tests
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
buildah bud --pull -f Int.Dockerfile -t $REGISTRY\:${{ steps.vars_step.outputs.sha-short }}-test \
-t $REGISTRY\:${{ steps.vars_step.outputs.branch }}-${{ github.run_number }}-test \
-t $REGISTRY\:latest-test . && \
buildah push $REGISTRY\:${{ steps.vars_step.outputs.branch }}-${{ github.run_number }}-test && \
buildah push $REGISTRY\:latest-test