mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 23:00:48 +08:00
测试 docker-build-push
This commit is contained in:
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -7,16 +7,19 @@ env:
|
|||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
another-job:
|
setup-node-environment-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: yanhao98/composite-actions/setup-node-environment@main
|
- uses: yanhao98/composite-actions/setup-node-environment@main
|
||||||
- name: Check Node and PNPM versions
|
- name: Check Node and PNPM versions
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
node --version
|
|
||||||
pnpm --version
|
|
||||||
which pnpm
|
which pnpm
|
||||||
date
|
docker-build-push-test:
|
||||||
pwd
|
runs-on: ubuntu-latest
|
||||||
ls -al
|
steps:
|
||||||
|
- uses: yanhao98/composite-actions/docker-build-push@main
|
||||||
|
# - name: Check Docker image
|
||||||
|
# run: |
|
||||||
|
# set -x
|
||||||
|
# docker run --rm ghcr.io/yanhao98/composite-actions:latest pnpm --version
|
37
docker-build-push/action.yml
Normal file
37
docker-build-push/action.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: "打包推送 Docker 镜像"
|
||||||
|
description: "打包 Docker 镜像并推送到 Docker Hub"
|
||||||
|
inputs:
|
||||||
|
dockerhub_username:
|
||||||
|
description: "Docker Hub 用户名"
|
||||||
|
required: true
|
||||||
|
dockerhub_token:
|
||||||
|
description: "Docker Hub Token"
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@main
|
||||||
|
with:
|
||||||
|
filter: blob:none
|
||||||
|
show-progress: false
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ inputs.dockerhub_username }}
|
||||||
|
password: ${{ inputs.dockerhub_token }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
Reference in New Issue
Block a user