chore: refactor publish workflow to separate build and deploy jobs, enhancing clarity and maintainability

This commit is contained in:
keven1024
2026-03-07 10:57:58 +08:00
parent 72560cf233
commit 8f1ced62ac

View File

@@ -6,7 +6,7 @@ on:
- '*'
jobs:
publish:
build-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -21,7 +21,7 @@ jobs:
with:
images: fudaoyuanicu/015-app
tags: |
type=ref,event=tag
type=pep440,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Set build time
id: build-time
@@ -40,6 +40,29 @@ jobs:
build-args: |
VERSION=${{ gitea.ref_name || github.ref_name }}
BUILD_TIME=${{ steps.build-time.outputs.time }}
build-worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: fudaoyuanicu
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/metadata-action@v5
id: meta
with:
images: fudaoyuanicu/015-worker
tags: |
type=pep440,pattern={{version}}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Set build time
id: build-time
run: |
echo "time=$(date +%s)" >> $GITHUB_OUTPUT
shell: bash
- name: build-worker
uses: docker/build-push-action@v5
with:
@@ -49,6 +72,11 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
runs-on: ubuntu-latest
needs: [build-app, build-worker]
steps:
- name: Send deployment webhook
run: |
curl -X POST http://192.168.100.5:8364/v1/update \