Skip to content

Commit 4ad1382

Browse files
authored
Merge pull request #1 from isaaccomputerscience/foglio/workflow-publish
Add docker image publishing action.
2 parents 1261b6d + 28a8362 commit 4ad1382

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
- name: Log in to the Container registry
22+
uses: docker/login-action@v2
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Docker meta
28+
id: meta
29+
uses: docker/metadata-action@v4
30+
with:
31+
images: ghcr.io/${{ github.repository }}
32+
tags: |
33+
# set latest tag for default branch
34+
type=raw,value=latest,enable={{is_default_branch}}
35+
# tag event
36+
type=ref,event=tag
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@v3
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)