Skip to content

Commit 77786c7

Browse files
committed
ci: add docker image publishing action
1 parent 35c4cb5 commit 77786c7

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registries:
9+
name: Push Docker image to multiple registries
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
contents: read
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v3
17+
18+
- name: Log in to Docker Hub
19+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
20+
with:
21+
username: ${{ secrets.DOCKER_USERNAME }}
22+
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
23+
24+
- name: Log in to the Container registry
25+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
34+
with:
35+
images: |
36+
lxlu/openapi-cop
37+
ghcr.io/${{ github.repository }}
38+
39+
- name: Build and push Docker images
40+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)