Skip to content

Add test action

Add test action #47

Workflow file for this run

on:
pull_request:
branches:
- main
types: [closed]
name: '[autorelease] PR merged'
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@v3
- 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"
if [[ -f $GITHUB_OUTPUT ]]; then
echo "release-version=$VERSION" >> $GITHUB_OUTPUT
else
echo "::set-output name=release-version::$VERSION"
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: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'v${{ steps.get-release-version.outputs.release-version }}'
release_name: 'Release ${{ steps.get-release-version.outputs.release-version }}'
draft: true
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 }}"