Skip to content

Commit 1f075cb

Browse files
authored
Merge pull request #187 from volcano-sh/copilot/add-docker-release-workflow
Add automated image release workflow
2 parents dca5472 + 074b212 commit 1f075cb

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Image Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*.*.*"
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
docker-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Determine image tag
24+
run: |
25+
if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ github.ref }}" == "refs/heads/main" ]; then
26+
echo "TAG=latest" >> $GITHUB_ENV
27+
else
28+
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
29+
fi
30+
31+
- name: Login to DockerHub
32+
uses: docker/login-action@v3
33+
with:
34+
username: ${{ secrets.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKERHUB_TOKEN }}
36+
37+
- name: Build and push frontend image
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: .
41+
file: ./deployment/build/frontend/Dockerfile
42+
push: true
43+
tags: volcanosh/vc-dashboard-frontend:${{ env.TAG }}
44+
platforms: linux/amd64,linux/arm64
45+
46+
- name: Build and push backend image
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
file: ./deployment/build/backend/Dockerfile
51+
push: true
52+
tags: volcanosh/vc-dashboard-backend:${{ env.TAG }}
53+
platforms: linux/amd64,linux/arm64
54+
55+
- name: Logout from Docker Hub
56+
if: always()
57+
run: docker logout

0 commit comments

Comments
 (0)