Skip to content

Update GKE operator in rancher/charts #20

Update GKE operator in rancher/charts

Update GKE operator in rancher/charts #20

name: Update GKE operator in rancher/charts
on:
workflow_dispatch:
inputs:
charts_ref:
description: 'Target rancher/charts branch against which a PR will be opened'
required: true
default: "dev-v2.9"
type: choice
options:
- "dev-v2.7"
- "dev-v2.8"
- "dev-v2.9"
previous_operator_version:
description: 'Previous operator version (e.g. 1.1.0-rc2)'
required: true
default: ""
new_operator_version:
description: 'New operator version'
required: true
default: ""
previous_chart_version:
description: 'Previous Rancher chart version (e.g. 101.1.0)'
required: true
default: ""
new_chart_version:
description: 'New Rancher chart version'
required: true
default: ""
should_replace:
description: 'Should the old operator version be replaced/removed? (e.g. true in case of release candidate bumps)'
required: true
default: true
type: boolean
env:
OPERATOR: gke-operator
jobs:
create-rancher-charts-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout operator repository to invoke release script
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
path: ${{ env.OPERATOR }}
persist-credentials: false
- name: Checkout rancher/charts
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
repository: ${{ github.repository_owner }}/charts
ref: ${{ github.event.inputs.charts_ref }}
path: charts
persist-credentials: false
- name: Set env variables
run: |
echo "TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV
CHARTS_REF=${{ github.event.inputs.charts_ref }}
echo "VERSION=${CHARTS_REF: -4}" >> $GITHUB_ENV
- name: Create new charts branch
working-directory: charts
run: |
git checkout -b ${{ env.OPERATOR }}-$VERSION-$TIMESTAMP
- name: Run release script
run: |
./${{ env.OPERATOR }}/.github/scripts/update-rancher-charts.sh \
${{ github.event.inputs.previous_operator_version }} \
${{ github.event.inputs.new_operator_version }} \
${{ github.event.inputs.previous_chart_version }} \
${{ github.event.inputs.new_chart_version }} \
${{ github.event.inputs.should_replace }}
- name: Create remote branch
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
working-directory: charts
run: |
git remote -v
git remote add bot https://${GITHUB_TOKEN}@github.com/highlander-ci-bot/charts.git
git remote
git push bot HEAD:${{ env.OPERATOR }}-$VERSION-$TIMESTAMP
git diff .
# - name: Create PR
# uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
# with:
# github-token: ${{secrets.CI_BOT_TOKEN}}
# script: |
# github.pulls.create({
# owner: context.repo.owner,
# repo: 'charts',
# title: 'Update ${{github.event.inputs.operator_path}} to v${{github.event.inputs.new_operator_version}}',
# head: 'highlander-ci-bot/charts:${{github.event.inputs.new_version}}-$TIMESTAMP',
# base: ${{github.event.inputs.charts_ref}},
# body: 'Update ${{github.event.inputs.operator_path}} to v${{github.event.inputs.new_operator_version}}\n\nChangelog: https://github.com/rancher/${{github.event.inputs.operator_path}}/releases/tag/v${{github.event.inputs.new_operator_version}}\n\ncc @rancher/highlander'
# })