-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (80 loc) · 2.81 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (80 loc) · 2.81 KB
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
name: Release
on:
workflow_dispatch:
workflow_run:
workflows: ["Unittests"]
branches: [main]
types:
- completed
release:
types: [published]
jobs:
build-and-push-images:
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
include:
- platform: linux/amd64
nginx_image: "nginx:1.12-alpine"
image_tag: "amd64"
- platform: linux/arm64
nginx_image: "arm64v8/nginx:stable-alpine"
image_tag: "arm64"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/learn-graph-frontend-${{ matrix.image_tag }}
# always push :latest tag
flavor: |
latest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: ${{ matrix.platform }}
build-args: NGINX_IMAGE=${{ matrix.nginx_image }}
push: true
tags: ${{ steps.meta.outputs.tags }}
upload-docker-image-manifest:
needs:
- build-and-push-images
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Docker meta
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/learn-graph-frontend
# always push :latest tag
flavor: |
latest=true
- uses: int128/docker-manifest-create-action@v2
id: build
with:
push: true
index-annotations: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
# manually get the image version from the 'meta' step to register a manifest for a multi-architecture image
sources: |
${{ secrets.DOCKER_HUB_USERNAME }}/learn-graph-frontend-amd64:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
${{ secrets.DOCKER_HUB_USERNAME }}/learn-graph-frontend-arm64:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}