Skip to content

Commit fad3420

Browse files
committed
Ensure main publish workflow uses short SHA
1 parent eea6147 commit fad3420

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Log in to Docker Hub
25+
uses: docker/login-action@v3
26+
with:
27+
username: ${ secrets.DOCKER_HUB_USER }
28+
password: ${ secrets.DOCKER_HUB_PAT }
29+
30+
- name: Set image tag
31+
run: |
32+
SHORT_SHA=$(git rev-parse --short HEAD)
33+
IMAGE_TAG="kuberhealthy/ssh-check:${SHORT_SHA}"
34+
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
35+
36+
- name: Build and push
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
file: ./Dockerfile
41+
push: true
42+
tags: ${ env.IMAGE_TAG }
43+
44+
- name: Publish summary
45+
run: |
46+
echo "Images pushed:" >> "$GITHUB_STEP_SUMMARY"
47+
echo "- ${ env.IMAGE_TAG }" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)