Skip to content

Commit 4cd8c61

Browse files
authored
Publish to GHCR
1 parent 672228a commit 4cd8c61

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/publish.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: Publish
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
- name: Login to GitHub Container Registry
15+
uses: docker/login-action@v3
16+
with:
17+
registry: ghcr.io
18+
username: ${{ github.actor }}
19+
password: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Generate tag
21+
id: tag
22+
run: |
23+
ts=$(date +%s)
24+
branch=${GITHUB_REF##*/}
25+
echo "IMAGE_ID=${branch}-${GITHUB_SHA::8}-${ts}" >> "$GITHUB_OUTPUT"
26+
- name: Publish Docker image
27+
uses: docker/build-push-action@v5
28+
with:
29+
context: .
30+
push: true
31+
tags: |
32+
ghcr.io/jroy/disgit:latest
33+
ghcr.io/jroy/disgit:${{ steps.tag.outputs.IMAGE_ID }}

0 commit comments

Comments
 (0)