|
1 | 1 | name: Docker Publish |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - branches: |
6 | | - - main |
7 | | - push: |
8 | | - branches: |
9 | | - - main |
10 | | - tags: |
11 | | - - 'v*' |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + tags: |
| 11 | + - 'v*' |
12 | 12 |
|
13 | 13 | env: |
14 | | - REGISTRY: ghcr.io |
15 | | - IMAGE_NAME: ${{ github.repository }} |
| 14 | + REGISTRY: ghcr.io |
| 15 | + IMAGE_NAME: ${{ github.repository }} |
16 | 16 |
|
17 | 17 | jobs: |
18 | | - build-and-push: |
19 | | - runs-on: ubuntu-latest |
20 | | - permissions: |
21 | | - contents: read |
22 | | - packages: write |
| 18 | + build-and-push: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + packages: write |
23 | 23 |
|
24 | | - steps: |
25 | | - - name: Checkout repository |
26 | | - uses: actions/checkout@v4 |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
27 | 27 |
|
28 | | - - name: Set up Docker Buildx |
29 | | - uses: docker/setup-buildx-action@v3 |
| 28 | + - name: Set up Docker Buildx |
| 29 | + uses: docker/setup-buildx-action@v3 |
30 | 30 |
|
31 | | - - name: Log in to GitHub Container Registry |
32 | | - if: github.event_name != 'pull_request' |
33 | | - uses: docker/login-action@v3 |
34 | | - with: |
35 | | - registry: ${{ env.REGISTRY }} |
36 | | - username: ${{ github.actor }} |
37 | | - password: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + - name: Log in to GitHub Container Registry |
| 32 | + if: github.event_name != 'pull_request' |
| 33 | + uses: docker/login-action@v3 |
| 34 | + with: |
| 35 | + registry: ${{ env.REGISTRY }} |
| 36 | + username: ${{ github.actor }} |
| 37 | + password: ${{ secrets.GITHUB_TOKEN }} |
38 | 38 |
|
39 | | - - name: Extract metadata (tags, labels) |
40 | | - id: meta |
41 | | - uses: docker/metadata-action@v5 |
42 | | - with: |
43 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
44 | | - tags: | |
45 | | - # latest on main branch |
46 | | - type=raw,value=latest,enable={{is_default_branch}} |
47 | | - # version tag (v1.2.3 -> 1.2.3) |
48 | | - type=semver,pattern={{version}} |
49 | | - # major.minor (v1.2.3 -> 1.2) |
50 | | - type=semver,pattern={{major}}.{{minor}} |
51 | | - # major only (v1.2.3 -> 1) |
52 | | - type=semver,pattern={{major}} |
53 | | - # sha for traceability |
54 | | - type=sha,prefix=sha-,format=short |
| 39 | + - name: Extract metadata (tags, labels) |
| 40 | + id: meta |
| 41 | + uses: docker/metadata-action@v5 |
| 42 | + with: |
| 43 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 44 | + tags: | |
| 45 | + # latest on main branch |
| 46 | + type=raw,value=latest,enable={{is_default_branch}} |
| 47 | + # version tag (v1.2.3 -> 1.2.3) |
| 48 | + type=semver,pattern={{version}} |
| 49 | + # major.minor (v1.2.3 -> 1.2) |
| 50 | + type=semver,pattern={{major}}.{{minor}} |
| 51 | + # major only (v1.2.3 -> 1) |
| 52 | + type=semver,pattern={{major}} |
| 53 | + # sha for traceability |
| 54 | + type=sha,prefix=sha-,format=short |
55 | 55 |
|
56 | | - - name: Build and push Docker image |
57 | | - uses: docker/build-push-action@v6 |
58 | | - with: |
59 | | - context: . |
60 | | - push: ${{ github.event_name != 'pull_request' }} |
61 | | - tags: ${{ steps.meta.outputs.tags }} |
62 | | - labels: ${{ steps.meta.outputs.labels }} |
63 | | - cache-from: type=gha |
64 | | - cache-to: type=gha,mode=max |
65 | | - # amd64 only - arm64 fails due to QEMU emulation issues with npm ci |
66 | | - platforms: linux/amd64 |
| 56 | + - name: Build and push Docker image |
| 57 | + uses: docker/build-push-action@v6 |
| 58 | + with: |
| 59 | + context: . |
| 60 | + push: ${{ github.event_name != 'pull_request' }} |
| 61 | + tags: ${{ steps.meta.outputs.tags }} |
| 62 | + labels: ${{ steps.meta.outputs.labels }} |
| 63 | + cache-from: type=gha |
| 64 | + cache-to: type=gha,mode=max |
| 65 | + # amd64 only - arm64 fails due to QEMU emulation issues with npm ci |
| 66 | + platforms: linux/amd64 |
0 commit comments