forked from pklaus/docker-ca-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.78 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build and publish image to ghcr.io/epics-containers
on:
push:
pull_request:
jobs:
build:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
epics-target: [linux-x86_64] # , linux-aarch64]
include:
- os: ubuntu-latest # everyone is on ubuntu-latest
- epics-target: linux-x86_64
platform: linux/amd64
# # a temporary name until multi-arch is supported
# - epics-target: linux-aarch64
# extension: -native-aarch64
# platform: linux/arm64
runs-on: ${{ matrix.os }}
env:
TAG: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
steps:
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
target: final
cache-from: type=gha,scope=${{ matrix.epics-target }}
cache-to: type=gha,mode=max,scope=${{ matrix.epics-target }}
tags: ci_test
load: true
- name: Test image
# Opportunity to run tests using docker run 'ci_test'
if: ${{ matrix.epics-target == 'linux-x86_64' }}
run: if [ -f tests/run-tests.sh ]; then tests/run-tests.sh ci_test; fi
- name: Push final image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
target: final
tags: ${{ env.TAG }}:${{ github.ref_name }}
push: true
- name: Push debug image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
target: builder
tags: ${{ env.TAG }}-debug:${{ github.ref_name }}
push: true
release:
# Release on tag push
needs: [build]
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
runs-on: ubuntu-latest
steps:
- name: Github Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
generate_release_notes: true