Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Oct 3, 2024
1 parent bed3f60 commit 14204e1
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
# 检查是否有变更
- name: Check for changes in the repository
run: |
if [ -z "$(git status --porcelain)" ]; then
if [ -z "$(git diff --cached --name-only)" ] && [ -z "$(git status --porcelain)" ]; then
echo "No changes detected, ending job."
exit 0
fi
Expand All @@ -77,7 +77,12 @@ jobs:
- name: Commit changes
run: |
git add .
git commit -m "chore(build): $commit_message"
if [ -z "$(git diff --cached --name-only)" ]; then
echo "No changes detected, ending job."
exit 0
else
git commit -m "chore(build): $commit_message"
fi
# 推送到 build 分支
- name: Push changes
Expand All @@ -87,13 +92,30 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_with_lease: true

- name: Create build zip
run: |
find . \( -path "./node_modules" -o -path "./.git" \) -prune -o -type f -print | zip -@ build.zip
- name: Upload build.zip as artifact
uses: actions/upload-artifact@v3
with:
name: build-zip
path: build.zip

# 更新版本号
- name: Run release-please
uses: googleapis/release-please-action@v4
id: release_please
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}
bump-minor-pre-major: true
version-file: package.json
fork: false
create-release: true

- name: Upload Release Artifact
if: ${{ steps.release_please.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.release_please.outputs.tag_name }} build.zip

0 comments on commit 14204e1

Please sign in to comment.