Skip to content

Update usage example #23

Update usage example

Update usage example #23

Workflow file for this run

name: Release
on:
push:
tags:
- v?[0-9]+.[0-9]+**
workflow_call:
inputs:
tag:
description: Target tag
required: true
type: string
jobs:
release:
name: page
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: extract tag (version)
id: version
run: |
if [ -z "${{ inputs.tag }}" ]; then
echo "value=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
else
echo "value=${{ inputs.tag }}" >> $GITHUB_OUTPUT
fi
# checkout needed for changelog only
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.version.outputs.value }}
- id: changelog
name: Generate Changelog
continue-on-error: true
run: |
git fetch --tags --all --prune-tags --force
TAG_FIRST=$(git describe --abbrev=0 --tags $(git describe --abbrev=0)^)
TAG_SECOND=$(git describe --abbrev=0)
echo "Generating changelog between tags: ${{ steps.version.outputs.value }}...$TAG_FIRST...$TAG_SECOND"
RESULT_FILE=generated-changelog.md
RESULT_LOG_ACT="$(git log $TAG_SECOND...${{ steps.version.outputs.value }} --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)"
RESULT_LOG_POST="$(git log $TAG_FIRST...$TAG_SECOND --pretty=format:'- %s [·](${{ github.event.repository.html_url }}/commit/%H)' --reverse)"
echo "
## TODO: EDIT ME BEFORE PUBLISH
__Changelog ${{ steps.version.outputs.value }}__…${TAG_SECOND}
$RESULT_LOG_ACT
__${TAG_SECOND}__…${TAG_FIRST}
$RESULT_LOG_POST
<!-- Built with ♥️. -->
" > $RESULT_FILE
echo "file=$RESULT_FILE" >> $GITHUB_OUTPUT
- id: release
name: create release "${{ steps.version.outputs.value }}"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: true
tag_name: ${{ steps.version.outputs.value }}
release_name: ${{ steps.version.outputs.value }}
body_path: ${{ steps.changelog.outputs.file }}