Skip to content
# 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
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 "tag=v$(date '+%Y%m%d%H%M%S').R${REVISION:=0}-${MICROSERVICE:=default}" >> $GITHUB_OUTPUT
- name: Create a tag on the input commit (gh-api)
if: false
continue-on-error: true
uses: actions/github-script@v6
with:
script: |
const { VERSION_TAG, COMMIT_SHA } = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${VERSION_TAG}`,
sha: COMMIT_SHA
})
env:
VERSION_TAG: ${{ steps.set-version.outputs.tag }}
COMMIT_SHA: ${{ github.sha }}
- name: Create a tag on the input commit (gh-cli)
run: |
gh release create ${{ env.VERSION_TAG }} --target ${{ env.COMMIT_SHA }} --generate-notes
env:
GH_TOKEN: ${{ github.token }}
VERSION_TAG: ${{ steps.set-version.outputs.tag }}
COMMIT_SHA: ${{ github.sha }}
- name: Create a tag on the input commit (git-cli)
if: false
continue-on-error: true
run: |
git tag ${{ env.VERSION_TAG }} ${{ env.COMMIT_SHA }}
git push --tag
env:
VERSION_TAG: ${{ steps.set-version.outputs.tag }}
COMMIT_SHA: ${{ github.sha }}