Skip to content

Create Release PR

Create Release PR #38

Workflow file for this run

name: "Create Release PR"
on:
workflow_dispatch:
inputs:
version:
description: New release version (e.g. 2.3.1)
type: string
required: true
ref:
description: Source branch/ref to create a release from
type: string
required: true
default: develop
target_branch:
description: Target branch to create a release/PR to
type: string
required: true
default: master
jobs:
create-release-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
token: "${{ secrets.RENKUBOT_GITHUB_TOKEN }}"
ref: '${{ github.event.inputs.ref }}'
- uses: actions/setup-node@v3
- name: Create Branch
run: git checkout -b "release/v${{ github.event.inputs.version }}"
- name: Merge Target
run: git merge "origin/${{ github.event.inputs.target_branch }}"
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:rmescandon/yq
sudo apt-get update -y
sudo apt-get install -y pandoc yq
npm install -g conventional-changelog-cli
- name: Update changelog
id: changelog
run: |
echo '{"version": "${{ github.event.inputs.version }}"}' > context.json
conventional-changelog -r 1 -p angular -c context.json | sed -e '1,${s/^# /## /}' | pandoc --from markdown --to rst | sed -e '/=======/r /dev/stdin' -e '0,/=======/ s/=======/=======\n/' -i CHANGES.rst
conventional-changelog -r 1 -p angular -c context.json | sed -e '1,${s/^# /## /}' > release_body.md
rm context.json
- name: Update Chart version
run: |
yq eval -i '.version = "${{ github.event.inputs.version }}"' helm-chart/renku-core/Chart.yaml
- name: Update Values file version
run: |
yq eval -i '.versions.latest.image.tag = "v${{ github.event.inputs.version }}"' helm-chart/renku-core/values.yaml
- name: commit changes
run: |
git config --global --add user.name "Renku Bot"
git config --global --add user.email "[email protected]"
git config push.autoSetupRemote true
git add helm-chart/renku-core/values.yaml helm-chart/renku-core/Chart.yaml renku/version.py CHANGES.rst
git commit -m "chore: release v${{ github.event.inputs.version }}"
git push
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
draft: true
bodyFile: "release_body.md"
tag: "v${{ github.event.inputs.version }}"
name: "v${{ github.event.inputs.version }}"
commit: "${{ github.event.inputs.target_branch }}"
- name: Create Pull Request
uses: actions/github-script@v6
with:
token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'chore: release v${{ github.event.inputs.version }}',
owner,
repo,
head: 'release/v${{ github.event.inputs.version }}',
base: '${{ github.event.inputs.target_branch }}',
body: [
'This PR is auto-generated by',
'[actions/github-script](https://github.com/actions/github-script).'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['feature', 'automated pr']
});