Skip to content

Update release.yml #140

Update release.yml

Update release.yml #140

Workflow file for this run

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Release
permissions: write-all
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install dependencies
run: npm install -g conventional-changelog-cli
- name: Find last tag
id: last_tag
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0 || echo 'v0.0.0')"
- name: Generate new version number
id: version
run: |
LAST_TAG=${{ steps.last_tag.outputs.tag }}
VERSION=$(echo $LAST_TAG | sed 's/v//')
IFS='.' read -r -a version_array <<< "$VERSION"
MAJOR=${version_array[0]}
MINOR=${version_array[1]}
PATCH=${version_array[2]}
((PATCH++))
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "::set-output name=new_version::$NEW_VERSION"
- name: Generate changelog since last tag
run: |
conventional-changelog -p angular -i CHANGELOG.md -s -r ${{ steps.last_tag.outputs.tag }}..HEAD
- name: Push changes
run: |
git push origin main
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: v${{ steps.version.outputs.new_version }}
release_name: Release v${{ steps.version.outputs.new_version }}
body: $(cat CHANGELOG.md)
draft: false
prerelease: false