change: update workflows, push docker image to ghcr.io

This commit is contained in:
EstrellaXD
2023-05-19 12:07:44 +08:00
parent 96529165ac
commit 344a8ff9a7
3 changed files with 32 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
name: Deploy To Dockerhub(dev)
name: Build Docker(dev)
on:
push:
@@ -36,20 +36,27 @@ jobs:
working-directory: ./src
run: |
echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Build and push
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GITHUB_USERNAME }}
password: ${{ secrets.ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
@@ -57,6 +64,8 @@ jobs:
tags: |
estrellaxd/auto_bangumi:dev-latest
estrellaxd/auto_bangumi:${{ github.ref_name }}
ghcr.io/estrellaxd/auto_bangumi:dev-latest
ghcr.io/estrellaxd/auto_bangumi:${{ github.ref_name }}
file: Dockerfile
generate_release:

View File

@@ -1,4 +1,4 @@
name: Build(Docker)
name: Build Docker
on:
pull_request:
@@ -61,6 +61,14 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to ghcr.io
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
@@ -68,7 +76,9 @@ jobs:
builder: ${{ steps.buildx.output.name }}
platforms: linux/amd64,linux/arm64,linux/arm
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
tags: |
docker.io/estrellaxd/auto_bangumi:${{ steps.meta.outputs.tags }}
ghcr.io/estrellaxd/auto_bangumi:${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}