-
Notifications
You must be signed in to change notification settings - Fork 1
96 lines (82 loc) · 2.43 KB
/
build-ptp.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build ptp image
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'develop'
- 'v*.*.*'
tags:
- 'v*.*.*'
paths:
- 'ptp/**'
pull_request:
branches:
- 'main'
- 'develop'
- 'v*.*.*'
paths:
- 'ptp/**'
permissions:
contents: read
packages: write
jobs:
build-ptp:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
#DOCKER_USER: ${{ secrets.DOCKER_USER }}
#DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
working-directory: ./ptp
ingress-working-directory: ./ingress
steps:
- uses: actions/checkout@v3
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
#- name: docker login
# run: |
# docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GH_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
#username: ${{ github.actor }}
#password: ${{ secrets.GH_TOKEN }}
- name: Docker meta
id: meta_ptp
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{env.working-directory}}
platforms: linux/amd64,linux/arm64
#,linux/arm/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta_ptp.outputs.tags }}
labels: ${{ steps.meta_ptp.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max, size=5GB
#cache-from: type=registry,ref=ptp/ptp:buildcache
#cache-to: type=registry,ref=ptp/ptp:buildcache,mode=max