👷 ci: add dockerHub

This commit is contained in:
Martial BE 2024-02-26 10:08:53 +08:00
parent bfebf70b99
commit b663519204
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084

View File

@ -9,7 +9,8 @@ on:
env: env:
# github.repository as <account>/<repo> # github.repository as <account>/<repo>
IMAGE_NAME: martialbe/one-api DOCKER_HUB_USERNAME: martialbe
DOCKER_HUB_REPO: one-api
jobs: jobs:
build-and-push: build-and-push:
@ -33,15 +34,24 @@ jobs:
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.actor }}
password: ${{ secrets.GT_Token }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} # Replace with your Docker Hub password secret
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
# list of Docker images to use as base name for tags # list of Docker images to use as base name for tags
images: ghcr.io/${{ env.IMAGE_NAME }} images: |
ghcr.io/${{ github.repository }}
docker.io/${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_HUB_REPO }}
# generate Docker tags based on the following events/attributes # generate Docker tags based on the following events/attributes
tags: | tags: |
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }} type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}