7 Commits

Author SHA1 Message Date
da7c4ac612 feat: 添加检查 .git 文件夹的步骤 2024-10-09 11:46:38 +08:00
aca6c13ecb fix: 修复 docker-build-push action.yml 中的 context 配置 2024-10-09 11:34:13 +08:00
a6b302e68a feat: 测试 semantic-release-action 2024-10-09 11:31:41 +08:00
dd22eed198 测试 Check .git folder 2024-10-09 11:27:20 +08:00
3624aae550 测试 metadata_tags 2024-10-09 11:09:53 +08:00
f622e0b7fa 测试 metadata_tags 2024-10-09 11:07:08 +08:00
dfea1166e1 测试 ref_type 2024-10-09 11:04:22 +08:00
4 changed files with 42 additions and 5 deletions

View File

@ -19,6 +19,13 @@ jobs:
docker-build-push-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: yanhao98/semantic-release-action@main
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
uses: docker/login-action@v3
with:
@ -37,13 +44,12 @@ jobs:
with:
build_file: ./docker-build-push/Dockerfile
build_platforms: linux/amd64
build_push: ${{ github.ref == 'refs/heads/main' }}
build_push: ${{ github.ref_type == 'tag' }}
build_load: true
metadata_images: |
docker.io/${{ vars.DOCKERHUB_USERNAME }}/docker-example
ghcr.io/${{ github.repository }}
metadata_tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

7
.releaserc.json Normal file
View File

@ -0,0 +1,7 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog"
]
}

View File

@ -33,7 +33,19 @@ outputs:
runs:
using: "composite"
steps:
- name: Check .git folder
id: check-git-folder
shell: bash
run: |
if [ -d .git ]; then
echo "Found .git folder"
echo "git-folder-exists=true" >> $GITHUB_OUTPUT
else
echo "No .git folder found"
echo "git-folder-exists=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@main
if: steps.check-git-folder.outputs.git-folder-exists == 'false'
with:
filter: blob:none
show-progress: false

View File

@ -16,7 +16,19 @@ description: "Setup pnpm + Node.js + install dependencies"
runs:
using: "composite"
steps:
- name: Check .git folder
id: check-git-folder
shell: bash
run: |
if [ -d .git ]; then
echo "Found .git folder"
echo "git-folder-exists=true" >> $GITHUB_OUTPUT
else
echo "No .git folder found"
echo "git-folder-exists=false" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@main
if: steps.check-git-folder.outputs.git-folder-exists == 'false'
with:
# fetch-depth: 0 # zero stands for full checkout, which is required for semantic-release
filter: blob:none # we don't need all blobs, only the full tree