Skip to content

Commit

Permalink
webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
sucooer committed Oct 1, 2024
1 parent ec3ca71 commit eb993c9
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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

0 comments on commit eb993c9

Please sign in to comment.