Skip to content

Commit 1ce2cb3

Browse files
authored
chore: publish tagged docker image on release (#33)
1 parent 8c6cd21 commit 1ce2cb3

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Latest Docker Image
2+
3+
permissions:
4+
packages: write
5+
contents: read
6+
7+
on:
8+
release:
9+
types:
10+
- published
11+
12+
env:
13+
ORG: 'sprintertech'
14+
REGISTRY: 'ghcr.io'
15+
16+
jobs:
17+
build-and-push:
18+
runs-on: ubuntu-latest
19+
steps:
20+
# Checkout the repository
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
# Log in to GHCR
25+
- name: Log in to GHCR
26+
id: ghcr
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
34+
# Build and push the Docker image
35+
- name: Build and push Docker image
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
push: true
40+
# Pass build arguments for the GitHub credentials
41+
build-args: |
42+
GH_USER_NAME=${{ secrets.GH_USER_NAME }}
43+
GH_USER_TOKEN=${{ secrets.GHCR_TOKEN }}
44+
tags: |
45+
${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}

0 commit comments

Comments
 (0)