This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (80 loc) · 3.63 KB
/
ci.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
89
90
91
92
93
94
95
96
name: CI
# Controls when the workflow will run
on:
release:
types: [published]
workflow_dispatch:
env:
registry_name: ghcr.io
image_name: ${{ github.repository_owner }}/azure-iotedge-plc-publisher
module_path: ./src/PlcPublisher/modules/PLC-Publisher/
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- name: amd64
platformName: linux/amd64
- name: arm64v8
platformName: linux/arm64/v8
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: true
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
- name: Docker Login
# You may pin to the exact commit or the version.
uses: docker/[email protected]
with:
registry: ${{ env.registry_name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Build and push ${{ matrix.arch.name }}
# You may pin to the exact commit or the version.
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
# Build's context is the set of files located in the specified PATH or URL
context: ${{ env.module_path }}
# Path to the Dockerfile
file: "${{ env.module_path }}/Dockerfile.${{ matrix.arch.name }}"
# Push is a shorthand for --output=type=registry
push: true
# List of SSH agent socket or keys to expose to the build
ssh: # optional
# List of tags
tags: ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-${{ matrix.arch.name }}
platforms: ${{ matrix.arch.platformName }}
publish:
runs-on: ubuntu-latest
needs: build
steps:
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
- name: Docker Login
# You may pin to the exact commit or the version.
uses: docker/[email protected]
with:
registry: ${{ env.registry_name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create the manifest
run: docker manifest create ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }} --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-amd64 --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-arm64v8
- name: Publish the manifest
run: docker manifest push ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}
- name: Create the manifest
run: docker manifest create ${{ env.registry_name }}/${{ env.image_name }}:latest --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-amd64 --amend ${{ env.registry_name }}/${{ env.image_name }}:${{ steps.docker-tag.outputs.tag }}-arm64v8
- name: Publish the manifest
run: docker manifest push ${{ env.registry_name }}/${{ env.image_name }}:latest