Skip to content

Commit 314979e

Browse files
authored
ci: upgrade GitHub Actions and add latest-<short-sha> image tag (#365)
* ci: upgrade GitHub Actions and add latest-<short-sha> image tag
1 parent 2a89f56 commit 314979e

2 files changed

Lines changed: 50 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,36 @@ jobs:
1212
steps:
1313
-
1414
name: Checkout
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
16+
-
17+
name: Short SHA
18+
id: vars
19+
run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
1620
-
1721
name: Set up QEMU
18-
uses: docker/setup-qemu-action@v1
22+
uses: docker/setup-qemu-action@v3
1923
-
2024
name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v1
25+
uses: docker/setup-buildx-action@v3
2226
-
2327
name: Login to DockerHub
24-
uses: docker/login-action@v1
28+
uses: docker/login-action@v3
2529
with:
2630
username: ${{ secrets.DOCKERHUB_USERNAME }}
2731
password: ${{ secrets.DOCKERHUB_TOKEN }}
2832
-
2933
name: Build and push
30-
uses: docker/build-push-action@v2
34+
id: docker_build
35+
uses: docker/build-push-action@v6
3136
with:
3237
context: .
3338
push: true
34-
tags: steemit/hivemind:latest
39+
tags: |
40+
steemit/hivemind:latest
41+
steemit/hivemind:latest-${{ steps.vars.outputs.short_sha }}
3542
-
36-
name: Image digest
37-
run: echo ${{ steps.docker_build.outputs.digest }}
43+
name: Pushed tags
44+
run: |
45+
echo "Pushed image tags:"
46+
echo " - steemit/hivemind:latest"
47+
echo " - steemit/hivemind:latest-${{ steps.vars.outputs.short_sha }}"

.github/workflows/pr-build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: pr-docker-build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
docker-build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v4
15+
-
16+
name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
-
19+
name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
-
22+
name: Build (no push)
23+
uses: docker/build-push-action@v6
24+
with:
25+
context: .
26+
push: false
27+
tags: hivemind:pr-check
28+
cache-from: type=gha
29+
cache-to: type=gha,mode=max
30+
-
31+
name: Build succeeded
32+
run: echo "Docker image built successfully. No push to Docker Hub."

0 commit comments

Comments
 (0)