Skip to content

Commit 0b55d6b

Browse files
committed
test
1 parent 807e372 commit 0b55d6b

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

.github/workflows/docker.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,10 @@ env:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15+
if: github.ref == 'refs/heads/main'
1516
permissions:
1617
contents: read
1718
packages: write
18-
19-
strategy:
20-
matrix:
21-
platform:
22-
- linux/amd64
23-
- linux/arm64
24-
2519
steps:
2620
- name: Checkout repository
2721
uses: actions/checkout@v4
@@ -36,29 +30,19 @@ jobs:
3630
username: ${{ github.actor }}
3731
password: ${{ secrets.GITHUB_TOKEN }}
3832

39-
- name: Extract platform suffix and commit hash
40-
id: platform
41-
run: |
42-
platform_pair=${{ matrix.platform }}
43-
platform_suffix=${platform_pair#*/}
44-
commit_hash=${GITHUB_SHA::7}
45-
echo "suffix=${platform_suffix}" >> $GITHUB_OUTPUT
46-
echo "commit=${commit_hash}" >> $GITHUB_OUTPUT
47-
48-
- name: Extract metadata
33+
- name: Extract metadata for latest
4934
id: meta
5035
uses: docker/metadata-action@v5
5136
with:
5237
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5338
tags: |
54-
type=raw,value=${{ steps.platform.outputs.commit }}-${{ steps.platform.outputs.suffix }}
55-
type=raw,value=latest-${{ steps.platform.outputs.suffix }},enable={{is_default_branch}}
39+
type=raw,value=latest
5640
57-
- name: Build and push Docker image
41+
- name: Build and push latest multi-platform image
5842
uses: docker/build-push-action@v5
5943
with:
6044
context: .
61-
platforms: ${{ matrix.platform }}
45+
platforms: linux/amd64,linux/arm64
6246
push: true
6347
tags: ${{ steps.meta.outputs.tags }}
6448
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)