Skip to content

Commit 161610c

Browse files
authored
Update build-docker.yml
1 parent 12cf348 commit 161610c

File tree

1 file changed

+12
-42
lines changed

1 file changed

+12
-42
lines changed

.github/workflows/build-docker.yml

+12-42
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,22 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
6-
name: Publish Docker image
1+
name: Deploy
72

83
on:
9-
release:
10-
types: [published]
4+
push:
5+
branches:
6+
- main # Adjust as per your branch requirements
117

128
jobs:
13-
push_to_registry:
14-
name: Push Docker image to Docker Hub
9+
deploy:
1510
runs-on: ubuntu-latest
16-
permissions:
17-
packages: write
18-
contents: read
19-
attestations: write
20-
id-token: write
2111
steps:
22-
- name: Check out the repo
23-
uses: actions/checkout@v4
24-
25-
- name: Log in to Docker Hub
26-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
27-
with:
28-
username: ${{ secrets.DOCKER_USERNAME }}
29-
password: ${{ secrets.DOCKER_PASSWORD }}
30-
31-
- name: Extract metadata (tags, labels) for Docker
32-
id: meta
33-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
12+
- name: Login to Docker Hub
13+
uses: docker/login-action@v3
3414
with:
35-
images: my-docker-hub-namespace/my-docker-hub-repository
15+
username: ${{ secrets.DOCKERHUB_USERNAME }}
16+
password: ${{ secrets.DOCKERHUB_TOKEN }}
3617

37-
- name: Build and push Docker image
38-
id: push
39-
uses: docker/build-push-action@v5.3.0
18+
- name: Build and push
19+
uses: docker/build-push-action@v5
4020
with:
41-
context: .
42-
file: ./Dockerfile
4321
push: true
44-
tags: ${{ steps.meta.outputs.tags }}
45-
labels: ${{ steps.meta.outputs.labels }}
46-
47-
- name: Generate artifact attestation
48-
uses: actions/attest-build-provenance@v1
49-
with:
50-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51-
subject-digest: ${{ steps.push.outputs.digest }}
52-
push-to-registry: true
22+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/my-image:latest

0 commit comments

Comments
 (0)