Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
chore(github): 💚update Auto Release
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorax-neo committed Jan 30, 2024
1 parent 0072f4e commit 36277ff
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/Auto Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,52 @@ name: Auto Release

on:
push:
branches:
- master
tags:
- 'release-v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate release notes
id: generate_notes
run: |
echo "::set-output name=notes::$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:'- %s')"
shell: bash
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Extract first line of commit message
id: extract_line
- name: Generate Changelog
id: changelog
run: |
echo "::set-output name=line::$(echo "${{ github.event.head_commit.message }}" | head -n1)"
npm install -g conventional-changelog-cli
conventional-changelog -p angular -i CHANGELOG.md -s -r 0
cp CHANGELOG.md ./tmp_changelog
- name: Set Release Name
shell: bash
id: set_release_name
run: echo "tag=$(echo $GITHUB_REF | sed 's|refs/tags/||')" >> $GITHUB_OUTPUT

- name: Create Release
id: create_release
uses: actions/create-release@v1
if: contains(github.event.head_commit.message, 'release-v')
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
# GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.GB_TOKEN }}
with:
tag_name: ${{ steps.extract_line.outputs.line }}
release_name: ${{ steps.extract_line.outputs.line }}
body: ${{ steps.generate_notes.outputs.notes }}
# tag_name: 使用 tag
tag_name: ${{ github.ref }}
# release_name: 使用 tag
name: ${{ steps.set_release_name.outputs.tag }}
# body: 使用 changelog
body_path: ./tmp_changelog
# 草稿
draft: false
# 预发布
prerelease: false
# 自动生成 release notes
generate_release_notes: true

0 comments on commit 36277ff

Please sign in to comment.