Automatically generate changelog (#220)

This commit is contained in:
folex 2021-07-27 16:41:23 +03:00 committed by GitHub
parent 81cd3a2c71
commit b6989058fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 35 deletions

View File

@ -0,0 +1,6 @@
{
"template": "## Changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
"pr_template": "- #${{NUMBER}} ${{TITLE}}",
"empty_template": "## No changes since ${{FROM_TAG}}",
"sort": "DESC"
}

View File

@ -2,18 +2,10 @@ name: "release"
on:
push:
# uncomment to release only on tags starting with 'v'
# tags:
# - "v*"
branches:
- "main"
workflow_dispatch:
inputs:
release:
description: "Draft or public release?\nPut 'draft' to make a draft release"
required: false
default: 'public'
jobs:
release:
@ -33,7 +25,6 @@ jobs:
env:
BUILD_NUMBER: ${{ github.run_number }}
### Create release
- name: Get project version
# In CI sbt appends a new line after its output, so we need `tail -n3 | head -n2` to get last two non-empty lines
run: |
@ -68,11 +59,7 @@ jobs:
node-version: "14"
registry-url: "https://registry.npmjs.org"
- name: Install jq and prepare package
run: |
sudo apt-get update && sudo apt-get --yes --force-yes install jq
PKG_NAME="$(cat package.json | jq -r .name)"
cp ${{ env.JAR }} ./npm/aqua-cli.jar
- run: cp ${{ env.JAR }} ./npm/aqua-cli.jar
- run: npm version ${{ env.VERSION }}
working-directory: ./npm
@ -82,27 +69,31 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Determine if release should be drafted
run: |
set -x
if [ "${{ github.event.inputs.release }}" = "public" ]; then
echo "DRAFT=false" >> $GITHUB_ENV
else
echo "DRAFT=true" >> $GITHUB_ENV
fi
### create release
- uses: marvinpinto/action-automatic-releases@latest
# if inputs.release if an empty string, we're running automatically
if: ${{ github.event.inputs.release != '' }}
- name: Push tag ${{ env.BASE_VERSION }}
id: tag_version
uses: mathieudutour/github-tag-action@v5.5
with:
# changelog will be automatically generated from the history
# between tag env.BASE_VERSION (eg 0.1.0 or 0.2.0, etc)
# and the current commit
automatic_release_tag: "${{ env.BASE_VERSION }}"
title: "Aqua Compiler ${{ env.VERSION }}"
files: |
${{ env.JAR }}
draft: ${{ env.DRAFT }}
custom_tag: ${{ env.BASE_VERSION }}
tag_prefix: ""
github_token: ${{ secrets.PERSONAL_TOKEN }}
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v1
with:
configuration: ".github/workflows/changelog_config.json"
toTag: ${{ steps.tag_version.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
name: Aqua Compiler ${{ env.VERSION }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.github_release.outputs.changelog }}
draft: false
prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}