ci: Refactor release workflow to use environment variables for Docker Hub credentials and dynamically determine Docker Hub image name.

This commit is contained in:
CJACK
2026-02-20 02:23:58 +08:00
parent 210d9f5793
commit c509066943
2 changed files with 8 additions and 8 deletions

View File

@@ -13,12 +13,8 @@
#### 🔀 变更说明 | Description of Change
<!-- Thank you for your Pull Request. Please provide a description above. -->
#### 📝 补充信息 | Additional Information
<!-- Add any other context about the Pull Request here. -->
---
> 💡 **提示**:如果修改了 `webui/` 目录下的文件PR 合并后 CI 会自动构建并提交产物,无需手动构建。

View File

@@ -12,6 +12,9 @@ permissions:
jobs:
build-and-upload:
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -87,10 +90,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
if: "${{ env.DOCKERHUB_USERNAME != '' }}"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta_release
@@ -98,7 +102,7 @@ jobs:
with:
images: |
ghcr.io/${{ github.repository }}
cjackhwang/ds2api
${{ env.DOCKERHUB_USERNAME || 'cjackhwang' }}/ds2api
tags: |
type=raw,value=${{ github.event.release.tag_name }}
type=raw,value=latest