This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.09 KB
/
build.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
name: Build
on:
push:
tags:
- v*.*.*
schedule:
- cron: '0 16 1,15 * *'
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
platform: ['multi', 'amd64']
include:
# arg for `--platform`
- platform: 'multi'
platforms: ${{ vars.DOCKER_ALL_PLATFORMS }}
# image list
- platform: 'multi'
image: 'debian'
tag: 'sid'
- platform: 'amd64'
image: 'archlinux'
tag: 'base'
# define latest tags for images
- platform: 'multi'
image: 'debian'
latest: 'bookworm'
- platform: 'amd64'
image: 'archlinux'
latest: 'base'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ matrix.platform }}/${{ matrix.image }}/${{ matrix.tag }}/
platforms: ${{ matrix.platforms }}
push: true
tags: |
${{ vars.DOCKERHUB_USERNAME }}/${{ matrix.image }}:${{ matrix.tag }}
${{ (matrix.tag == matrix.latest) && format('{0}/{1}:latest', vars.DOCKERHUB_USERNAME, matrix.image) || '' }}
ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ matrix.tag }}
${{ (matrix.tag == matrix.latest) && format('ghcr.io/{0}/{1}:latest', github.repository_owner, matrix.image) || '' }}