Skip to content

Commit 336dd6b

Browse files
chore: prevent web build trigger repeatedly
1 parent b3d6c04 commit 336dd6b

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/docker.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ on:
55
types: [published]
66

77
jobs:
8-
build:
8+
build-web:
99
runs-on: ubuntu-latest
10-
strategy:
11-
matrix:
12-
java_version: [8, 11, 17, 21]
1310

1411
steps:
1512
- uses: actions/checkout@v4
@@ -22,6 +19,40 @@ jobs:
2219
name=ghcr.io/${{ github.repository }}-web
2320
name=githubyumao/mcsmanager-web,enable=${{ github.repository == 'MCSManager/MCSManager' }}
2421
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Login to ghcr.io
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Login to DockerHub
33+
if: ${{ github.repository == 'MCSManager/MCSManager' }}
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
37+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
38+
39+
- name: Build and Push Web
40+
uses: docker/build-push-action@v6
41+
with:
42+
file: dockerfile/web.dockerfile
43+
push: true
44+
tags: ${{ steps.meta_web.outputs.tags }}
45+
labels: ${{ steps.meta_web.outputs.labels }}
46+
47+
build-daemon:
48+
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
java_version: [8, 11, 17, 21]
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
2556
- name: Docker meta daemon
2657
id: meta_daemon
2758
uses: docker/metadata-action@v5
@@ -49,14 +80,6 @@ jobs:
4980
username: ${{ secrets.DOCKER_HUB_USERNAME }}
5081
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
5182

52-
- name: Build and Push Web
53-
uses: docker/build-push-action@v6
54-
with:
55-
file: dockerfile/web.dockerfile
56-
push: true
57-
tags: ${{ steps.meta_web.outputs.tags }}
58-
labels: ${{ steps.meta_web.outputs.labels }}
59-
6083
- name: Build and Push Daemon
6184
uses: docker/build-push-action@v6
6285
with:

0 commit comments

Comments
 (0)