Skip to content

Commit 9dcda8b

Browse files
authored
Update docker-image.yml
1 parent 5fb3e62 commit 9dcda8b

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

.github/workflows/docker-image.yml

+28-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1-
name: Docker Image CI
1+
name: Publish Docker image
22

33
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
4+
release:
5+
types: [published]
86

97
jobs:
10-
11-
build:
12-
8+
push_to_registry:
9+
name: Push Docker image to Docker Hub
1310
runs-on: ubuntu-latest
14-
1511
steps:
16-
- uses: actions/checkout@v3
17-
- name: Build the Docker image
18-
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
12+
- name: Check out the repo
13+
uses: actions/checkout@v3
14+
15+
- name: Log in to Docker Hub
16+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
17+
with:
18+
username: ${{ secrets.DOCKER_USERNAME }}
19+
password: ${{ secrets.DOCKER_PASSWORD }}
20+
21+
- name: Extract metadata (tags, labels) for Docker
22+
id: meta
23+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
24+
with:
25+
images: jiaqizhu/pico-sdk
26+
27+
- name: Build and push Docker image
28+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
29+
with:
30+
context: .
31+
file: ./Dockerfile
32+
push: true
33+
tags: ${{ steps.meta.outputs.tags }}
34+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)