Skip to content

3.21.10

3.21.10 #146

Workflow file for this run

name: Release
on:
push:
branches:
- main
jobs:
publish-github:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Extract version
id: version
run: |
OLD_VERSION=$(git describe --tags --abbrev=0)
NEW_VERSION_NUMBER_ONLY=$(node -p 'require("./package.json").version')
NEW_VERSION=v${NEW_VERSION_NUMBER_ONLY}
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then
echo "New version $NEW_VERSION detected"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
git log "$OLD_VERSION"..HEAD --pretty=format:"* %s" --invert-grep --grep="$NEW_VERSION_NUMBER_ONLY" > CHANGELOG.md
else
echo "Version $OLD_VERSION hasn't changed, skipping the release"
fi
- name: Create a git tag
if: env.NEW_VERSION != env.OLD_VERSION
run: git tag $NEW_VERSION && git push --tags
- name: GitHub release
if: env.NEW_VERSION != env.OLD_VERSION
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ env.NEW_VERSION }}
tag_name: ${{ env.NEW_VERSION }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}