Skip to content

Commit 7088cbd

Browse files
authored
Merge pull request #36 from stackhpc/docker-publish
Add a workflow to publish a Docker image on release
2 parents 864dc89 + 6baaf00 commit 7088cbd

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Build and publish a Docker image
3+
on:
4+
release:
5+
types: [published]
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
jobs:
10+
build-and-push-image:
11+
name: Build and publish a Docker image
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Log in to the Container registry
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ${{ env.REGISTRY }}
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Extract metadata (tags, labels) for Docker
28+
id: meta
29+
uses: docker/metadata-action@v4
30+
with:
31+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v4
35+
with:
36+
context: .
37+
push: true
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)