-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.71 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
name: CI
on:
push:
branches: [ master ]
paths:
- 'Dockerfile*'
- 'docker-bake.hcl'
- '.github/workflows/CI.yml'
pull_request:
branches: [ master ]
paths:
- 'Dockerfile*'
- 'docker-bake.hcl'
- '.github/workflows/CI.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
target: [ "all", "18", "17", "16", "16-alpine", "15", "14", "13", "12", "11", "10", "9", "8", "7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.3.0
- name: Check formatting
run: make install-deps && make lint
- name: Login container registries
run: |
echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin
docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_PASSWORD }}'
env:
CR_PAT: ${{ secrets.CR_PAT }}
- name: Check buildx bake
run: docker buildx bake --file docker-bake.hcl --print
- name: Build image for tag ${{ matrix.target }}
if: github.ref == 'refs/heads/master'
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --load
- name: Publish image for tag ${{ matrix.target }}
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --push
- name: Remove builder instances
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: docker buildx rm --all-inactive --force