Skip to content

Commit 23bdbd9

Browse files
short hash
1 parent f6bc170 commit 23bdbd9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/deployment.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 1
15+
- name: Calculate short hash
16+
run: |
17+
shortHash=$(git rev-parse --short ${{ github.sha }})
18+
echo "COMMIT_SHORT_SHA=$hash" >> $GITHUB_ENV
1519
- name: SSH setup and run commands
1620
uses: appleboy/ssh-action@v1.0.3
1721
with:
@@ -23,6 +27,6 @@ jobs:
2327
cd ./deploy/${{ github.event.repository.name }}
2428
git pull
2529
docker rm --force ${{ github.event.repository.name }}-deploy || true
26-
docker build -t ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:$(git rev-parse --short HEAD) --quiet .
27-
docker run --detach --name ${{ github.event.repository.name }}-deploy ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:$(git rev-parse --short HEAD)
30+
docker build -t ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:${{ env.COMMIT_SHORT_SHA }} --quiet .
31+
docker run --detach --name ${{ github.event.repository.name }}-deploy ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:${{ env.COMMIT_SHORT_SHA }}
2832
docker container prune --force && docker image prune --all --force

0 commit comments

Comments
 (0)