-
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (84 loc) · 2.64 KB
/
publish.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
97
name: Publish Docker Image
on:
push:
branches: [ main ]
schedule:
- cron: '0 0 1 * *' # At 00:00 on day-of-month 1.
workflow_dispatch:
env:
DOCKER_CLI_EXPERIMENTAL: enabled
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
matrix:
version: [16, 18, 20, lts]
permissions:
packages: write
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'main'
fetch-depth: 0
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/node
# ghcr.io/${{ github.repository_owner }}/node
# public.ecr.aws/${{ github.repository_owner }}/node
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
tags: |
type=raw,value=${{ matrix.version }}-alpine
flavor: |
latest=false
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver-opts: image=moby/buildkit:master
- name: Login to DockerHub
id: login-dockerhub
uses: docker/login-action@v3
with:
logout: false
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# # username: ${{ github.repository_owner }}
# username: ${{ github.actor }}
# password: ${{ github.token }}
# - name: Login to Public ECR
# uses: docker/login-action@v3
# with:
# registry: public.ecr.aws
# username: ${{ secrets.AWS_ECR_ACCESS_KEY_ID }}
# password: ${{ secrets.AWS_ECR_SECRET_ACCESS_KEY }}
# env:
# AWS_REGION: us-east-1
- name: Build and push Docker images
id: build-and-push
uses: docker/build-push-action@v5
continue-on-error: true
with:
push: ${{ github.event_name != 'pull_request' }}
context: .
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x
build-args: NODE_VERSION=${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max