Skip to content

Refactor release.yml to extract last commit message and set default t… #50

Refactor release.yml to extract last commit message and set default t…

Refactor release.yml to extract last commit message and set default t… #50

Workflow file for this run

name: Release for Figma
on:
push:
branches:
- ui-color-palette-*
pull_request:
types:
- closed
branches:
- ui-color-palette-*
jobs:
create-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract last commit message
id: extract_message
run: |
last_commit_message=$(git log --format=%B -n 1)
echo "::set-output name=last_commit_message::$last_commit_message"
- name: Set default tag name
if: steps.extract_message.outputs.last_commit_message == ''
run: |
echo "::set-output name=tag_name::default-tag-name"
id: default_tag_name
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_message.outputs.last_commit_message || steps.default_tag_name.outputs.tag_name }}
release_name: Release ${{ steps.extract_message.outputs.last_commit_message || steps.default_tag_name.outputs.tag_name }}
body: |
## What's Changed
[Friendly release note](https://ui-color-palette.canny.io/changelog/${{ steps.extract_message.outputs.last_commit_message || steps.default_tag_name.outputs.tag_name }})・[Full Changelog](https://github.com/inVoltag/figma-ui-color-palette/commits/${{ steps.extract_message.outputs.last_commit_message || steps.default_tag_name.outputs.tag_name }})