Merge pull request #3 from mmdapl/feat/add-changelog #4
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
# CD持续交付 | |
# - 部署到Github Pages | |
# - 部署到Vercel托管平台 | |
# - 发布新的Github Release | |
# 参考:https://v2.vuepress.vuejs.org/zh/guide/deployment.html#github-pages | |
# | |
name: CD | |
on: | |
push: | |
branches: | |
- next | |
workflow_dispatch: | |
jobs: | |
# 版本发布 | |
release: | |
name: 创建Github发布 | |
runs-on: ubuntu-latest | |
# 主库next且执行release更新时执行 | |
if: github.repository == '142vip/142vip-oauth' && startsWith(github.event.head_commit.message, 'chore(release):') | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.TOKEN }} | |
persist-credentials: false | |
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 | |
fetch-depth: 0 | |
# 打成压缩包 | |
- name: Create Zip Package | |
run: | | |
zip -r 142vip-oauth.zip . \ | |
-x "node_modules/*" \ | |
-x "*.git*" | |
# 提取版本号 | |
- name: Get New Version Number | |
id: releaseVersion | |
run: | | |
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
# 创建发布版本 | |
- name: Create New Release | |
id: createRelease | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: v${{ steps.releaseVersion.outputs.version }} | |
release_name: v${{ steps.releaseVersion.outputs.version }} | |
body: | | |
Release ${{ steps.releaseVersion.outputs.version }} | |
### ✨ Features | |
### 🐛 Bug Fixes | |
# 更新资源 | |
- name: Upload Resource Assets | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
upload_url: ${{ steps.createRelease.outputs.upload_url }} | |
asset_path: ./142vip-oauth.zip | |
asset_name: 142vip-oauth.zip | |
asset_content_type: application/zip |