feat: add Docker workflow for building and pushing images

This commit is contained in:
t8y2
2026-05-05 05:09:01 +08:00
parent f9a9945f1f
commit 371a763b9e
2 changed files with 31 additions and 2 deletions
+30
View File
@@ -115,3 +115,33 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit ${{ github.ref_name }} --repo ${{ github.repository }} --draft=false
docker:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/dbx:${{ steps.version.outputs.version }}
${{ secrets.DOCKERHUB_USERNAME }}/dbx:latest
cache-from: type=gha
cache-to: type=gha,mode=max