Create Tag #31
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 Tag | |
on: | |
workflow_run: | |
workflows: ["CI Pipeline"] | |
types: | |
- completed | |
jobs: | |
build-deploy: | |
if: github.repository == 'jaywcjlove/sgo-rs' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Read commit message | |
run: | | |
echo "Commit message 1: ${{ github.event.workflow_run.head_commit.message }}" | |
- name: Create Tag | |
id: create_tag | |
uses: jaywcjlove/create-tag-action@main | |
with: | |
test: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' | |
commit: ${{ github.event.workflow_run.head_commit.message }} | |
- name: Check if tag creation was successful | |
id: check_success | |
run: echo "success=${{ steps.create_tag.outputs.successful }}" >> $GITHUB_OUTPUT | |
- name: Generate Changelog | |
id: changelog | |
uses: jaywcjlove/changelog-generator@main | |
if: steps.create_tag.outputs.successful == 'true' | |
with: | |
head-ref: ${{ steps.create_tag.outputs.version }} | |
filter-author: (小弟调调™|Renovate Bot) | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
if: steps.create_tag.outputs.successful == 'true' | |
with: | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ steps.create_tag.outputs.version }} | |
tag: ${{ steps.create_tag.outputs.version }} | |
body: | | |
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) | |
Comparing Changes: ${{ steps.changelog.outputs.compareurl }} | |
${{ steps.changelog.outputs.changelog }} | |
- name: Trigger next workflow if successful | |
if: steps.check_success.outputs.success == 'true' | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d '{"event_type": "tag-creation-success", "client_payload": {"version": "${{ steps.create_tag.outputs.version }}" }}' \ | |
https://api.github.com/repos/${{ github.repository }}/dispatches | |