-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (44 loc) · 1.49 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
name: build
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
NGINX_VERSION: 1.27.2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: docker login to docker.io
uses: docker/login-action@v2
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
registry: docker.io
username: zengxs
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup binfmt-support
uses: docker/setup-qemu-action@v3
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
- name: Generate push tags
run: >-
python3 .github/workflows/generate-tags.py
--image-name docker.io/zengxs/nginx
--nginx-version ${{ env.NGINX_VERSION }}
--env-name PUSH_TAGS
>> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ env.PUSH_TAGS }}
# Only build multi-platform images on push to Docker Hub for reducing build time
platforms: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
NGINX_VERSION=${{ env.NGINX_VERSION }}