Skip to content

Release Candidate v0.0 #3

Release Candidate v0.0

Release Candidate v0.0 #3

name: Check PR to Release
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- 'release/**'
jobs:
check_release_branch:
name: No Commits
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Fetch base branch
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Check base branch has no commits since merge base
env:
BASE_BRANCH_HEAD_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -x
MERGE_BASE=$(git merge-base $PR_HEAD_SHA $BASE_BRANCH_HEAD_SHA)
echo $MERGE_BASE
echo $BASE_BRANCH_HEAD_SHA
if [ $MERGE_BASE != $BASE_BRANCH_HEAD_SHA ]; then
echo "Base branch has commits since merge base"
exit 1
fi
check_source_branch:
name: Check source branch
runs-on: ubuntu-latest
steps:
- name: Assert source branch is RC branch
if: ${{ !startsWith(github.head_ref, 'rc/') }}
run: exit 1
check_release_version:
name: Check release version
needs: check_source_branch
runs-on: ubuntu-latest
steps:
- name: Checkout necessary files
uses: actions/checkout@v4
with:
sparse-checkout: |
package.json
.github/parse-version/action.yml
sparse-checkout-cone-mode: false
- name: Parse version
id: version
uses: ./.github/parse-version
- name: Assert release version is not pre-release
if: endsWith(steps.version.outputs.releaseVersion, '-pre')
run: exit 1
- name: Assert release version matches RC branch name
if: format('rc/v{0}', steps.version.outputs.releaseShort) != github.event.pull_request.head.ref
run: exit 1