1+ name : Package Image
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ env :
9+ # Use docker.io for Docker Hub if empty
10+ REGISTRY : ghcr.io
11+ # github.repository as <account>/<repo>
12+ IMAGE_NAME : ${{ github.repository }}
13+
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+ # This is used to complete the identity challenge
21+ # with sigstore/fulcio when running outside of PRs.
22+ id-token : write
23+
24+ steps :
25+ - name : Checkout repository
26+ uses : actions/checkout@v3
27+
28+ # Install the cosign tool except on PR
29+ # https://github.com/sigstore/cosign-installer
30+ - name : Install cosign
31+ if : github.event_name != 'pull_request'
32+ uses : sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
33+ with :
34+ cosign-release : ' v1.9.0'
35+
36+ - name : Set up QEMU
37+ uses : docker/setup-qemu-action@v3
38+
39+ # Workaround: https://github.com/docker/build-push-action/issues/461
40+ - name : Setup Docker buildx
41+ uses : docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
42+
43+ # Login against a Docker registry except on PR
44+ # https://github.com/docker/login-action
45+ - name : Log into registry ${{ env.REGISTRY }}
46+ if : github.event_name != 'pull_request'
47+ uses : docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
48+ with :
49+ registry : ${{ env.REGISTRY }}
50+ username : ${{ github.actor }}
51+ password : ${{ secrets.GITHUB_TOKEN }}
52+
53+ # Build and push Docker image with Buildx (don't push on PR)
54+ # https://github.com/docker/build-push-action
55+ - name : Build and push Docker image - Chinese
56+ id : build-and-push-zh
57+ uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
58+ with :
59+ context : .
60+ build-args : LOCALE=zh
61+ push : ${{ github.event_name != 'pull_request' }}
62+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:zh,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:zh-${{ github.ref_name }}
63+ platforms : linux/amd64,linux/arm64
64+
65+ # Build and push Docker image with Buildx (don't push on PR)
66+ # https://github.com/docker/build-push-action
67+ - name : Build and push Docker image - English
68+ id : build-and-push-en
69+ uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
70+ with :
71+ context : .
72+ build-args : LOCALE=en
73+ push : ${{ github.event_name != 'pull_request' }}
74+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:en,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:en-${{ github.ref_name }}
75+ platforms : linux/amd64,linux/arm64
0 commit comments