Skip to content

Commit 7e969a9

Browse files
committed
update gh actions
1 parent 83c0396 commit 7e969a9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
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: Log in to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKER_USERNAME }}
26+
password: ${{ secrets.DOCKER_PASSWORD }}
27+
28+
- name: Build and push custom Docker image
29+
uses: docker/build-push-action@v6
30+
with:
31+
context: .
32+
file: Dockerfile
33+
platforms: linux/amd64,linux/arm64
34+
push: true
35+
tags: |
36+
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.ref_name }}
37+
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.ref_name }}-${{ github.sha }}
38+
39+
- name: Update latest release with Docker image details
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
42+
run: |
43+
release_body="### ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPOSITORY }} image
44+
\`\`\`shell
45+
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.ref_name }}
46+
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.ref_name }}-${{ github.sha }}
47+
\`\`\`"
48+
gh release create v${{ github.run_number }} --notes "$release_body"

0 commit comments

Comments
 (0)