Skip to content

Commit

Permalink
temp changes to make a pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
kessler-frost committed Nov 30, 2023
1 parent 3a52276 commit 33bced4
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ on:
required: true
type: boolean
default: true
prerelease:
description: "true: Create a prerelease. false: Create a stable release"
required: true
type: boolean
default: true
prerelease_version:
description: "The prerelease version to release"
required: false
type: string
default: "master"

workflow_call:
inputs:
prerelease:
Expand Down Expand Up @@ -68,18 +79,18 @@ jobs:
fetch-depth: 0
ref: "v${{ github.event.inputs.stable_version }}"
- name: Format prerelease ref
if: inputs.prerelease
if: github.event.inputs.prerelease_version
run: |
re='^[0-9]+$'
IFS='.' read -ra version <<< "${{ inputs.prerelease_version }}"
IFS='.' read -ra version <<< "${{ github.event.inputs.prerelease_version }}"
if [[ ${version[0]} =~ $re ]] ; then
echo "PRERELEASE=v$version" >> $GITHUB_ENV
else
echo "PRERELEASE=$version" >> $GITHUB_ENV
fi
- name: Check out prerelease tag
uses: actions/checkout@v4
if: inputs.prerelease
if: github.event.inputs.prerelease
with:
persist-credentials: false
fetch-depth: 0
Expand All @@ -96,7 +107,7 @@ jobs:

- name: Read version
run: |
if [ -z ${{ inputs.prerelease }} ] && \
if [ -z ${{ github.event.inputs.prerelease }} ] && \
[ -z ${{ github.event.inputs.stable_version }} ] ; then
echo "You can't create a stable release without specifying the stable version number."
exit 1
Expand All @@ -105,7 +116,7 @@ jobs:
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "RELEASE=v$VERSION" >> $GITHUB_ENV
- name: Generate prerelease message
if: inputs.prerelease
if: github.event.inputs.prerelease
id: message
run: |
begin=$(grep -n "\b${VERSION}\b" ./CHANGELOG.md | cut -d ':' -f 1)
Expand All @@ -125,7 +136,7 @@ jobs:
git push origin $RELEASE
- name: Create prerelease
if: >-
inputs.prerelease
github.event.inputs.prerelease
&& steps.message.outcome == 'success'
&& (!github.event.inputs.test_release || github.event.inputs.test_release == 'false')
uses: ncipollo/release-action@v1
Expand Down Expand Up @@ -196,7 +207,7 @@ jobs:
- name: Validate Distribution
id: validate
run: |
if [ -z ${{ inputs.prerelease }} ] && \
if [ -z ${{ github.event.inputs.prerelease }} ] && \
[ -z ${{ github.event.inputs.stable_version }} ] ; then
echo "You can't create a stable release without specifying the stable version number."
exit 1
Expand Down

0 comments on commit 33bced4

Please sign in to comment.