Skip to content

Commit 2e60b75

Browse files
committed
ci: create release workflow to push to dockerhub
1 parent 082113a commit 2e60b75

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
publish-to-dockerhub:
11+
name: Push Docker image to Docker Hub
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out the repo
15+
uses: actions/checkout@v3
16+
17+
- name: Log in to Docker Hub
18+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
- name: Extract metadata (tags, labels) for Docker
24+
id: meta
25+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
26+
with:
27+
images: codfish/json-server
28+
29+
- name: Build and push Docker image
30+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
31+
with:
32+
context: .
33+
push: true
34+
tags: ${{ steps.meta.outputs.tags }}
35+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)