Update create-release-notes-after-ci.yaml #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: apple | |
# 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 | |
- name: Set version tag | |
id: set-version | |
run: | | |
MICROSERVICE=${{ inputs.microservice }} | |
echo "microservice=${MICROSERVICE:=apple}" >> $GITHUB_OUTPUT | |
echo "tag=v$(date '+%Y%m%d%H%M')" >> $GITHUB_OUTPUT | |
- name: Write a release log | |
uses: cuchi/jinja2-action@v1.2.0 | |
with: | |
template: RELEASE-LOG.md | |
output_file: RELEASE-LOG.md | |
env: | |
RELEASE_SUMMARY: | | |
This contains a breaking change on apple. | |
COMMIT_HISTORY: | | |
- [APPLE-21] Initial commit for apple (#1) @elzino | |
- [APPLE-123] New change on apple microservice (#2) @lucetre | |
- [APPLE-939] Dummy PR (#3) @mayshin10 | |
- name: Create a tag on the input commit (gh-cli) | |
run: | | |
PREV_VERSION_TAG=$(gh release list | grep -m1 "${{ env.MICROSERVICE }}/*" | cut -f3) | |
gh release create "${{ env.MICROSERVICE }}/${{ env.CURR_VERSION_TAG }}" \ | |
--title "${{ env.MICROSERVICE }}: ${{ env.CURR_VERSION_TAG }}" \ | |
--target ${{ env.COMMIT_SHA }} \ | |
--notes-start-tag "${{ env.MICROSERVICE }}/$PREV_VERSION_TAG" \ | |
--generate-notes \ | |
--notes-file RELEASE-LOG.md | |
env: | |
GH_TOKEN: ${{ github.token }} | |
MICROSERVICE: ${{ steps.set-version.outputs.microservice }} | |
CURR_VERSION_TAG: ${{ steps.set-version.outputs.tag }} | |
COMMIT_SHA: ${{ github.sha }} |