Skip to content

Create Release Notes after CI #29

Create Release Notes after CI

Create Release Notes after CI #29

# This is a basic workflow to help you get started with Actions
name: Create Release Notes after CI
# Controls when the workflow will run
on:
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
microservice:
required: true
type: string
description: Name of Microservice
default: default
revision:
required: true
type: number
description: Revision
default: 0
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
- name: Set version tag
id: set-version
run: |
REVISION=${{ inputs.revision }}
MICROSERVICE=${{ inputs.microservice }}
echo "microservice=${MICROSERVICE:=default}" >> $GITHUB_OUTPUT
echo "tag=v$(date '+%Y%m%d%H%M').R${REVISION:=0}" >> $GITHUB_OUTPUT
- name: Create a tag on the input commit (gh-cli)
run: |
gh release create "${{ env.MICROSERVICE }}/${{ env.CURR_VERSION_TAG }}" \
--title "${{ env.MICROSERVICE }}: ${{ env.CURR_VERSION_TAG }}" \
--repo lucetre/action-release-notes \
--target ${{ env.COMMIT_SHA }} \
--notes-start-tag "${{ env.MICROSERVICE }}/${{ env.PREV_VERSION_TAG }}" \
--generate-notes \
--notes-file RELEASE-LOG.md
env:
GH_TOKEN: ${{ github.token }}
MICROSERVICE: ${{ steps.set-version.outputs.microservice }}
PREV_VERSION_TAG: v123.R4
CURR_VERSION_TAG: ${{ steps.set-version.outputs.tag }}
COMMIT_SHA: ${{ github.sha }}