Skip to content

Draft Release PR

Draft Release PR #18

name: Draft Release PR
# Description:
# This workflow will draft a new release PR for the helm chart if there is a new runner image/appVersion .
# A release PR will be created in these cases.
# - When a user kicks offs this workflow manually. A user can specify the CHART_VERSION and APP_VERSION used for the new release.
# - When the cron schedule kicks off the job and there is a new runner image tag available.
on:
schedule:
# Run every 12 hours at 55 minutes past the hour.
- cron: "55 */12 * * *"
workflow_dispatch:
inputs:
CHART_VERSION:
description: 'Optionally override the chart version in Chart.yaml.'
required: false
default: ''
APP_VERSION:
description: 'Optionally override the app version in Chart.yaml.'
required: false
default: ''
BRANCH_NAME:
description: 'Optionally override the branch name for PR.'
required: false
default: 'new-version-release'
jobs:
draft-release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
CHART_VERSION: ${{ github.event.inputs.CHART_VERSION }}
APP_VERSION: ${{ github.event.inputs.APP_VERSION }}
BRANCH_NAME: new-version-release
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Prepare Release
id: prepare_release
run: |
make CHART_VERSION=$CHART_VERSION APP_VERSION=$APP_VERSION prepare-release
make docker-docs
- name: Check if PR is needed
id: check_if_pr_open
run: |
echo "NEEDS_PR=1" >> "$GITHUB_OUTPUT"
git fetch origin
set +e # change shell behavior from github's default
# Directly check if the branch exists and has the same changes in the remote repository
git ls-remote --exit-code --heads origin ${BRANCH_NAME} > /dev/null 2>&1
if [ $? -eq 0 ]; then
set -e # revert to default behavior
if git diff --no-ext-diff --quiet origin/${BRANCH_NAME} -- charts; then
echo "NEEDS_PR=0" >> "$GITHUB_OUTPUT"
fi
fi
- name: Open PR for Version Update
id: open_pr
if: ${{ steps.prepare_release.outputs.NEEDS_UPDATE == 1 && steps.check_if_pr_open.outputs.NEEDS_PR == 1 }}
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
commit-message: Prepare chart release ${{ steps.prepare_release.outputs.NEW_CHART_VERSION }}
title: "chore: Prepare chart release ${{ steps.prepare_release.outputs.NEW_CHART_VERSION }}"
body: |
Description
- Release chart version ${{ steps.prepare_release.outputs.NEW_CHART_VERSION }}
- Update runner app version ${{ steps.prepare_release.outputs.NEW_APP_VERSION }}
branch: ${{ env.BRANCH_NAME }}
base: main
delete-branch: true
draft: always-true