Describe one more use case #27
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 Release on Tagged Commit | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get tag for current commit | |
id: get_tag | |
run: | | |
tag=$(git tag --points-at $GITHUB_SHA) | |
# Remove 'v' prefix if it exists for cleaner handling | |
version=${tag#v} | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Create release | |
if: ${{ steps.get_tag.outputs.tag }} | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.get_tag.outputs.tag }} | |
release_name: ${{ steps.get_tag.outputs.tag }} | |
body: | | |
[![npm](https://img.shields.io/badge/npm-v${{ steps.get_tag.outputs.version }}-blue.svg)](https://www.npmjs.com/package/use-m/v/${{ steps.get_tag.outputs.version }}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |