mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 06:40:49 +08:00
feat: 重构 CI 流程,新增 docker-build-push 工作流
Some checks failed
持续集成 / setup-node-environment-test (push) Successful in 19s
docker-build-push / docker-build-push-test (push) Failing after 52s
Some checks failed
持续集成 / setup-node-environment-test (push) Successful in 19s
docker-build-push / docker-build-push-test (push) Failing after 52s
This commit is contained in:
42
.github/workflows/ci.yml
vendored
42
.github/workflows/ci.yml
vendored
@ -17,45 +17,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
which pnpm
|
which pnpm
|
||||||
|
|
||||||
docker-build-push-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@main
|
|
||||||
- uses: yanhao98/semantic-release-action@main
|
|
||||||
id: semantic
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
if: steps.semantic.outputs.next_release_published == 'true'
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
if: steps.semantic.outputs.next_release_published == 'true'
|
|
||||||
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
|
|
||||||
if: steps.semantic.outputs.next_release_published == 'true'
|
|
||||||
id: docker-build-push
|
|
||||||
with:
|
|
||||||
build_file: ./docker-build-push/Dockerfile
|
|
||||||
build_platforms: linux/amd64,linux/arm64
|
|
||||||
build_push: true
|
|
||||||
build_load: false
|
|
||||||
metadata_images: |
|
|
||||||
docker.io/${{ vars.DOCKERHUB_USERNAME }}/docker-example
|
|
||||||
ghcr.io/${{ github.repository }}
|
|
||||||
metadata_tags: |
|
|
||||||
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.next_release_version }}
|
|
||||||
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.next_release_version }}
|
|
||||||
type=semver,pattern={{major}},value=${{ steps.semantic.outputs.next_release_version }}
|
|
||||||
# - name: Check Docker image
|
|
||||||
# run: |
|
|
||||||
# set -x;
|
|
||||||
# docker images;
|
|
||||||
# docker run --rm ${{ steps.docker-build-push.outputs.imageid }} whoami;
|
|
||||||
|
55
.github/workflows/docker-build-push.yml
vendored
Normal file
55
.github/workflows/docker-build-push.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name: docker-build-push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'docker-build-push/**'
|
||||||
|
- '.github/workflows/docker-build-push.yml'
|
||||||
|
|
||||||
|
env:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-build-push-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@main
|
||||||
|
- uses: yanhao98/semantic-release-action@main
|
||||||
|
id: semantic
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
# - name: Login to GitHub Container Registry
|
||||||
|
# if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
|
# 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
|
||||||
|
if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
|
id: docker-build-push
|
||||||
|
with:
|
||||||
|
build_file: ./docker-build-push/Dockerfile
|
||||||
|
build_platforms: linux/amd64,linux/arm64
|
||||||
|
build_push: true
|
||||||
|
build_load: false
|
||||||
|
metadata_images: |
|
||||||
|
docker.io/${{ vars.DOCKERHUB_USERNAME }}/docker-example
|
||||||
|
# ghcr.io/${{ github.repository }}
|
||||||
|
metadata_tags: |
|
||||||
|
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
|
type=semver,pattern={{major}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
|
# - name: Check Docker image
|
||||||
|
# run: |
|
||||||
|
# set -x;
|
||||||
|
# docker images;
|
||||||
|
# docker run --rm ${{ steps.docker-build-push.outputs.imageid }} whoami;
|
Reference in New Issue
Block a user