mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 06:40:49 +08:00
feat: 测试 semantic
This commit is contained in:
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
@ -2,6 +2,8 @@ name: 持续集成
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
@ -22,17 +24,15 @@ jobs:
|
|||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: yanhao98/semantic-release-action@main
|
- uses: yanhao98/semantic-release-action@main
|
||||||
id: semantic
|
id: semantic
|
||||||
- name: Print the new release version
|
|
||||||
run: |
|
|
||||||
echo ${{ steps.semantic.outputs.next_release_published }}
|
|
||||||
echo ${{ steps.semantic.outputs.next_release_version }}
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
|
if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@ -40,21 +40,22 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- uses: yanhao98/composite-actions/docker-build-push@main
|
- uses: yanhao98/composite-actions/docker-build-push@main
|
||||||
|
if: steps.semantic.outputs.next_release_published == 'true'
|
||||||
id: docker-build-push
|
id: docker-build-push
|
||||||
with:
|
with:
|
||||||
build_file: ./docker-build-push/Dockerfile
|
build_file: ./docker-build-push/Dockerfile
|
||||||
build_platforms: linux/amd64
|
build_platforms: linux/amd64,linux/arm64
|
||||||
build_push: ${{ github.ref_type == 'tag' }}
|
build_push: true
|
||||||
build_load: true
|
build_load: false
|
||||||
metadata_images: |
|
metadata_images: |
|
||||||
docker.io/${{ vars.DOCKERHUB_USERNAME }}/docker-example
|
docker.io/${{ vars.DOCKERHUB_USERNAME }}/docker-example
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
metadata_tags: |
|
metadata_tags: |
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}},value=${{ steps.semantic.outputs.next_release_version }}
|
||||||
- name: Check Docker image
|
# - name: Check Docker image
|
||||||
run: |
|
# run: |
|
||||||
set -x;
|
# set -x;
|
||||||
docker images;
|
# docker images;
|
||||||
docker run --rm ${{ steps.docker-build-push.outputs.imageid }} whoami;
|
# docker run --rm ${{ steps.docker-build-push.outputs.imageid }} whoami;
|
||||||
|
Reference in New Issue
Block a user