Skip to content

Remove test workflow #51

Remove test workflow

Remove test workflow #51

Workflow file for this run

on:
pull_request:
branches:
- main
types: [closed]
name: '[autorelease] PR merged'
permissions:
contents: read
pull-requests: write
jobs:
merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'autorelease')
steps:
- uses: actions/checkout@v4
- name: Get release version
id: get-release-version
run: |
# Head branch should be named autorelease/<version>
if ! [[ "${{ github.event.pull_request.head.ref }}" =~ ^autorelease\/[A-Za-z0-9.+-]+$ ]]; then
echo "::error::Invalid branch '${{ github.event.pull_request.head.ref }}'"
exit 1
fi
VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | awk -F/ '{print $2}')
echo "VERSION=$VERSION"
RE='^[vV]?([0-9]+)[.]([0-9]+)[.]([0-9]+)(-[0-9A-Za-z.+-]*)?'
if [[ $VERSION =~ $RE ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
PRERELEASE="${BASH_REMATCH[4]}"
else
echo "::error::Version '$VERSION' is not in a valid format" && exit 1
fi
if [[ "$PRERELEASE" ]]; then pre=true; else pre=false; fi
if [[ -f $GITHUB_OUTPUT ]]; then
echo "release-version=$VERSION" >> $GITHUB_OUTPUT
echo "is-prerelease=$pre" >> $GITHUB_OUTPUT
else
echo "::set-output name=release-version::$VERSION"
echo "::set-output name=is-prerelease::$pre"
fi
- name: Get release notes
id: get-release-notes
uses: ./
with:
command: query
version: ${{ steps.get-release-version.outputs.release-version}}
- name: Display release notes
run: |
echo "${{ steps.get-release-notes.outputs.release-notes }}"
- name: Create Draft Release
id: create_release
uses: release-flow/.github/actions/release/create@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-name: 'v${{ steps.get-release-version.outputs.release-version }}'
release-name: 'Release ${{ steps.get-release-version.outputs.release-version }}'
draft: true
prerelease: ${{ steps.get-release-version.outputs.is-prerelease}}
body: ${{ steps.get-release-notes.outputs.release-notes }}
- name: Display Instructions
run: |
echo "::notice title=Draft Release Prepared::A draft release has been prepared for you to approve: ${{ steps.create_release.outputs.html-url }}"