Update 509.bfaa49bc.js #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release with Zip | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
# 检出当前仓库的代码 | |
- uses: actions/checkout@v4 | |
# 获取提交信息和当前日期 | |
- name: Get Commit Info | |
id: get_commit_info | |
run: | | |
echo "commit_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "commit_message=$(git log -1 --pretty=%B)" >> $GITHUB_ENV | |
echo "release_date=$(date +"%Y-%m-%d")" >> $GITHUB_ENV | |
# 将当前目录下的所有文件打包为 zip 文件 | |
- name: Zip repository files | |
run: | | |
zip -r release-v1.0.${{ github.run_number }}.zip ./* | |
# 创建 Release | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v1.0.${{ github.run_number }} # 自动递增版本号 | |
release_name: "Release v1.0.${{ github.run_number }} - ${{ env.release_date }}" | |
body: | | |
### Release Notes | |
- **Commit SHA**: ${{ env.commit_sha }} | |
- **Commit Message**: ${{ env.commit_message }} | |
- **Release Date**: ${{ env.release_date }} | |
draft: false | |
prerelease: false | |
# 上传压缩文件到 Release | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: release-v1.0.${{ github.run_number }}.zip # 上传压缩文件 | |
asset_name: release-v1.0.${{ github.run_number }}.zip # 上传文件的名称 | |
asset_content_type: application/zip |