Release Charts #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Charts | |
on: | |
workflow_dispatch: | |
inputs: | |
server_version: | |
description: "Temporal Server version to use for release (for example 1.24.1)" | |
required: true | |
admintools_version: | |
description: "Temporal Admin Tools version to use for release (for example 1.24.1-tctl-1.18.1-cli-0.12.0)" | |
required: true | |
ui_version: | |
description: "Temporal UI version to use for release (for example 2.27.2)" | |
required: true | |
bump: | |
description: "Chart version bump level" | |
required: true | |
type: choice | |
default: minor | |
options: | |
- minor | |
- patch | |
force_version: | |
description: "Force a chart version (ignore Chart bump level)" | |
mark_latest: | |
description: "Mark this release as the latest" | |
type: boolean | |
default: true | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }} | |
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
token: ${{ steps.generate_token.outputs.token }} | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Configure Git | |
run: | | |
git config --local user.name 'Temporal Data' | |
git config --local user.email '[email protected]' | |
- name: Bump Temporal chart version | |
id: chart-version | |
working-directory: charts/temporal | |
run: | | |
CHART_VERSION="${{ github.event.inputs.force_version }}" | |
if [ -z "${CHART_VERSION}" ]; then | |
current="$(grep -m 1 '^version:' Chart.yaml | awk '{print $2}')" | |
RE='([0-9]+)\.([0-9]+)\.([0-9]+)' | |
MAJOR=`echo $current | sed -E "s#$RE#\1#"` | |
MINOR=`echo $current | sed -E "s#$RE#\2#"` | |
PATCH=`echo $current | sed -E "s#$RE#\3#"` | |
if [ "${{ github.event.inputs.bump }}" == "minor" ]; then | |
MINOR=$((MINOR+1)) | |
PATCH=0 | |
else | |
PATCH=$((PATCH+1)) | |
fi | |
CHART_VERSION="$MAJOR.$MINOR.$PATCH" | |
fi | |
echo "chart_version=$CHART_VERSION" >> "$GITHUB_OUTPUT" | |
- name: Update image tags | |
uses: mikefarah/yq@v4 | |
with: | |
cmd: | | |
yq -i '.server.image.tag = "${{ github.event.inputs.server_version }}"' charts/temporal/values.yaml | |
yq -i '.admintools.image.tag = "${{ github.event.inputs.admintools_version }}"' charts/temporal/values.yaml | |
yq -i '.web.image.tag = "${{ github.event.inputs.ui_version }}"' charts/temporal/values.yaml | |
- name: Update chart | |
uses: mikefarah/yq@v4 | |
with: | |
cmd: | | |
yq -i '.appVersion = "${{ github.event.inputs.server_version }}"' charts/temporal/Chart.yaml | |
yq -i '.version = "${{ steps.chart-version.outputs.chart_version }}"' charts/temporal/Chart.yaml | |
- name: Commit changes | |
working-directory: charts/temporal | |
run: | | |
git commit -m "Update Chart to ${{ steps.chart-version.outputs.chart_version }}." Chart.yaml values.yaml | |
git tag -a "temporal-${{ steps.chart-version.outputs.chart_version }}" -m "Release Chart: ${{ steps.chart-version.outputs.chart_version }}" | |
git push --tags origin main | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
mark_as_latest: "${{ github.event.inputs.mark_latest }}" | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |