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: on:
push: push:
# uncomment to release only on tags starting with 'v'
# tags:
# - "v*"
branches: branches:
- "main" - "main"
workflow_dispatch: workflow_dispatch:
inputs:
release:
description: "Draft or public release?\nPut 'draft' to make a draft release"
required: false
default: 'public'
jobs: jobs:
release: release:
@ -33,7 +25,6 @@ jobs:
env: env:
BUILD_NUMBER: ${{ github.run_number }} BUILD_NUMBER: ${{ github.run_number }}
### Create release
- name: Get project version - 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 # 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: | run: |
@ -68,11 +59,7 @@ jobs:
node-version: "14" node-version: "14"
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
- name: Install jq and prepare package - run: cp ${{ env.JAR }} ./npm/aqua-cli.jar
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: npm version ${{ env.VERSION }} - run: npm version ${{ env.VERSION }}
working-directory: ./npm working-directory: ./npm
@ -82,27 +69,31 @@ jobs:
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 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 ### create release
- uses: marvinpinto/action-automatic-releases@latest - name: Push tag ${{ env.BASE_VERSION }}
# if inputs.release if an empty string, we're running automatically id: tag_version
if: ${{ github.event.inputs.release != '' }} uses: mathieudutour/github-tag-action@v5.5
with: with:
# changelog will be automatically generated from the history custom_tag: ${{ env.BASE_VERSION }}
# between tag env.BASE_VERSION (eg 0.1.0 or 0.2.0, etc) tag_prefix: ""
# and the current commit github_token: ${{ secrets.PERSONAL_TOKEN }}
automatic_release_tag: "${{ env.BASE_VERSION }}"
title: "Aqua Compiler ${{ env.VERSION }}" - name: Build Changelog
files: | id: github_release
${{ env.JAR }} uses: mikepenz/release-changelog-builder-action@v1
draft: ${{ env.DRAFT }} 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 prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}" env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}