-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (62 loc) · 2.13 KB
/
main-tag.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
name: Build multiarch image - tag
on:
push:
tags:
- '[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Get latest tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF:10}
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.vars.outputs.tag }}
- name: Prepare
id: prep
run: |
BUILD_DATE=$(date --rfc-3339=seconds --utc)
echo ::set-output name=build_date::${BUILD_DATE}
PLATFORMS=amd64,arm,arm64
TAGS1="quay.io/${{ github.repository_owner }}/echoserver:${{ steps.vars.outputs.tag }}"
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=push::false
else
echo ::set-output name=push::true
echo ::set-output name=tags1::${TAGS1}
echo ::set-output name=branch::${GIT_BRANCH}
fi
echo ::set-output name=platforms::${PLATFORMS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: ${{ steps.prep.outputs.platforms }}
- name: Login to Quay.io
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:latest
- name: Build and push (echoserver)
uses: docker/build-push-action@v2
with:
labels: |
org.opencontainers.image.created=${{ steps.prep.outputs.build_date }}
builder: ${{ steps.buildx.outputs.name }}
context: .
file: Dockerfile
platforms: ${{ steps.prep.outputs.platforms }}
push: ${{ steps.prep.outputs.push }}
tags: ${{ steps.prep.outputs.tags1 }}