Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit dce8e94

Browse files
committed
feat: add continous deployment. Deploy on GitHub Packages
1 parent 0d46aa4 commit dce8e94

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/github-publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: GitHub Publish
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
# Publish semver tags as releases.
7+
tags: [ 'v*.*.*' ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
env:
12+
# Use docker.io for Docker Hub if empty
13+
REGISTRY: ghcr.io
14+
# github.repository as <account>/<repo>
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
30+
# Login against a Docker registry except on PR
31+
# https://github.com/docker/login-action
32+
- name: Log into registry ${{ env.REGISTRY }}
33+
if: github.event_name != 'pull_request'
34+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
# Extract metadata (tags, labels) for Docker
41+
# https://github.com/docker/metadata-action
42+
- name: Extract Docker metadata
43+
id: meta
44+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
45+
with:
46+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
48+
# Build and push Docker image with Buildx (don't push on PR)
49+
# https://github.com/docker/build-push-action
50+
- name: Build and push Docker image
51+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
52+
with:
53+
context: .
54+
push: ${{ github.event_name != 'pull_request' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)