Skip to content

Commit 561902f

Browse files
committed
publish image to ghcr
1 parent f060e17 commit 561902f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Create and publish a Docker image
11+
12+
on:
13+
workflow_dispatch:
14+
release:
15+
branches: [ main ]
16+
types: [ published ]
17+
18+
env:
19+
REGISTRY: ghcr.io
20+
IMAGE_NAME: ${{ github.repository }}
21+
22+
jobs:
23+
build-and-push-image:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
packages: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v3
32+
33+
- name: Log in to the Container registry
34+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata (tags, labels) for Docker
41+
id: meta
42+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
48+
with:
49+
context: .
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)