Create Pre-Release #269
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
name: Create Pre-Release | |
on: | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: 'Release commit' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
pre-release: | |
name: Pre-release | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Determine minor version | |
id: tag-setter | |
run: | | |
DATE=$(date +"%Y.%m.%d") | |
PREV_RELEASE=$(git tag --list | tail -1) | |
PREV_DATE="${PREV_RELEASE%.*}" | |
MINOR_VERSION=0 | |
case $PREV_DATE in | |
*"$DATE"*) | |
MINOR_VERSION=${PREV_RELEASE##*.} | |
MINOR_VERSION=$((MINOR_VERSION+1)) | |
;; | |
*) | |
MINOR_VERSION=0 | |
;; | |
esac | |
echo "TAG_VERSION=r.$DATE.$MINOR_VERSION" >> $GITHUB_ENV | |
- name: Set the release commit | |
run: echo "RELEASE_COMMIT=${{ github.event.inputs.commit }}" >> $GITHUB_ENV | |
- name: Create release body file | |
run: bash .github/scripts/get_description.sh | |
- name: Set release body | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 | |
with: | |
bodyFile: release_body.md | |
commit: ${{ github.event.inputs.commit }} | |
prerelease: true | |
tag: ${{ env.TAG_VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |