mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 14:50:48 +08:00
测试 Login to GitHub Container Registry
This commit is contained in:
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -15,14 +15,26 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
which pnpm
|
which pnpm
|
||||||
|
|
||||||
docker-build-push-test:
|
docker-build-push-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- uses: yanhao98/composite-actions/docker-build-push@main
|
- uses: yanhao98/composite-actions/docker-build-push@main
|
||||||
id: docker-build-push
|
id: docker-build-push
|
||||||
with:
|
with:
|
||||||
login_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
login_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
build_file: ./docker-build-push/Dockerfile
|
build_file: ./docker-build-push/Dockerfile
|
||||||
build_platforms: linux/amd64
|
build_platforms: linux/amd64
|
||||||
build_push: false
|
build_push: false
|
||||||
|
@ -1,16 +1,6 @@
|
|||||||
name: "打包推送 Docker 镜像"
|
name: "打包推送 Docker 镜像"
|
||||||
description: "打包 Docker 镜像并推送到 Docker Hub"
|
description: "打包 Docker 镜像并推送到 Docker Hub"
|
||||||
inputs:
|
inputs:
|
||||||
login_repository:
|
|
||||||
description: "docker/login-action 的 registry 参数"
|
|
||||||
default: "docker.io"
|
|
||||||
required: false
|
|
||||||
login_username:
|
|
||||||
description: "docker/login-action 的 username 参数"
|
|
||||||
required: true
|
|
||||||
login_password:
|
|
||||||
description: "docker/login-action 的 password 参数"
|
|
||||||
required: true
|
|
||||||
build_file:
|
build_file:
|
||||||
description: "Dockerfile 文件路径"
|
description: "Dockerfile 文件路径"
|
||||||
default: "./Dockerfile"
|
default: "./Dockerfile"
|
||||||
@ -25,7 +15,6 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
build_push:
|
build_push:
|
||||||
description: "是否推送 Docker 镜像"
|
description: "是否推送 Docker 镜像"
|
||||||
default: "true"
|
|
||||||
required: false
|
required: false
|
||||||
build_load:
|
build_load:
|
||||||
description: "是否加载 Docker 镜像"
|
description: "是否加载 Docker 镜像"
|
||||||
@ -48,18 +37,13 @@ runs:
|
|||||||
with:
|
with:
|
||||||
filter: blob:none
|
filter: blob:none
|
||||||
show-progress: false
|
show-progress: false
|
||||||
|
# https://docs.docker.com/build/ci/github-actions/push-multi-registries/
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5 # https://github.com/docker/metadata-action
|
uses: docker/metadata-action@v5 # https://github.com/docker/metadata-action
|
||||||
with:
|
with:
|
||||||
images: ${{ inputs.metadata_images }}
|
images: ${{ inputs.metadata_images }}
|
||||||
tags: ${{ inputs.metadata_tags }}
|
tags: ${{ inputs.metadata_tags }}
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ inputs.login_repository }}
|
|
||||||
username: ${{ inputs.login_username }}
|
|
||||||
password: ${{ inputs.login_password }}
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
Reference in New Issue
Block a user