Skip to content

Update README.md

Update README.md #3

Workflow file for this run

name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version_bump:
description: 'Trigger release for version bump'
required: false
default: 'false'
jobs:
create:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Set up Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Fetch all tags
run: git fetch --tags
- name: Get current version from package.json
run: |
echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Get previous release tag
id: get_previous_tag
run: |
latest_tag=$(gh release list --limit 1 --json tagName | jq -r '.[0].tagName')
echo "PREV_RELEASE=$latest_tag" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Check if version has been released
id: check_if_released
run: |
gh release view ${{ env.VERSION }} && echo "RELEASED=true" >> $GITHUB_ENV || echo "RELEASED=false" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
- name: Generate ChangeLog
if: success() && env.RELEASED == 'false'
run: |
changelog=$(git log ${{ env.PREV_RELEASE }}..HEAD --oneline)
echo "CHANGELOG=$changelog" >> $GITHUB_ENV
- name: Create Git Tag and Push
if: success() && env.RELEASED == 'false'
run: |
git tag -a "${{ env.VERSION }}" -m "Version ${{ env.VERSION }}"
git push origin "${{ env.VERSION }}"
echo "TAG_CREATED=true" >> $GITHUB_ENV
- name: Create Release
if: success() && env.TAG_CREATED == 'true'
uses: softprops/action-gh-release@master
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
prerelease: ${{ contains(env.VERSION, 'rc') }}
body: |
### ChangeLog
${{ env.CHANGELOG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}