Skip to content

Commit

Permalink
edit matrix build images
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanngocptn committed May 10, 2024
1 parent 6f4a363 commit 3b7dbaf
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:

jobs:
push-to-registry:
strategy:
matrix:
include:
- registry: 'docker.io'
- registry: 'ghcr.io'
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -13,11 +18,12 @@ jobs:
attestations: write
steps:
- uses: actions/checkout@v4
- name: Log in to Docker Hub
- name: Log in
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
password: ${{ matrix.registry == 'docker.io' && secrets.DOCKER_PASSWORD || secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
Expand All @@ -26,7 +32,7 @@ jobs:
images: tuanngocptn/sentry-telegram-webhook

- name: Build and push Docker image
id: push-docker-hub
id: push
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -38,30 +44,6 @@ jobs:
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: docker.io/tuanngocptn/sentry-telegram-webhook
subject-digest: ${{ steps.push-docker-hub.outputs.digest }}
subject-name: ${{ matrix.registry }}/tuanngocptn/sentry-telegram-webhook
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: tuanngocptn
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Build and push Docker image
# id: push-ghcr
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ghcr.io/tuanngocptn/sentry-telegram-webhook
# subject-digest: ${{ steps.push-ghcr.outputs.digest }}
# push-to-registry: true

0 comments on commit 3b7dbaf

Please sign in to comment.