Skip to content

Quote keys in toml (#38) #20

Quote keys in toml (#38)

Quote keys in toml (#38) #20

name: Release-plz
on:
push:
branches:
- main
workflow_dispatch: # Allow manual trigger
jobs:
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'softwaremill' && (github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'chore')) }}
permissions:
pull-requests: write
contents: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libssl-dev libsasl2-dev zlib1g-dev libzstd-dev liblz4-dev pkg-config jq libcurl4-openssl-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.93
- name: Rust version
id: rust_version
run: echo "version=$(rustc --version | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Rust Cache
uses: Swatinem/rust-cache@v2
if: ${{ !(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'release')) }}
with:
key: ${{ runner.os }}-cargo-${{ steps.rust_version.outputs.version }}-${{ github.ref_name }}-${{ hashFiles('**/Cargo.lock') }}
cache-targets: true
cache-on-failure: true
- name: Create Release PR
id: release_plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
outputs:
prs_created: ${{ steps.release_plz.outputs.prs_created }}
pr: ${{ steps.release_plz.outputs.pr }}
update-helm-release:
name: Update Helm chart in release branch
runs-on: ubuntu-22.04
needs: release-plz-pr
if: ${{ needs.release-plz-pr.outputs.prs_created == 'true' }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- name: Set release branch and version from release-plz output
run: |
echo "RELEASE_BRANCH=$(echo '${{ needs.release-plz-pr.outputs.pr }}' | jq -r '.head_branch')" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(echo '${{ needs.release-plz-pr.outputs.pr }}' | jq -r '.releases[0].version')" >> $GITHUB_ENV
- name: Checkout release branch
run: |
git fetch origin $RELEASE_BRANCH
git checkout $RELEASE_BRANCH
- name: Update Helm chart values.yaml and Chart.yaml
run: |
sed -i 's/tag: ".*"/tag: "'$RELEASE_VERSION'"/' helm/klag-exporter/values.yaml
sed -i 's/^appVersion: .*/appVersion: "'$RELEASE_VERSION'"/' helm/klag-exporter/Chart.yaml
sed -i 's/^version: .*/version: "'$RELEASE_VERSION'"/' helm/klag-exporter/Chart.yaml
cat helm/klag-exporter/values.yaml | grep -A 3 "^image:"
- name: Commit and push updated Helm chart files to release branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add helm/klag-exporter/values.yaml helm/klag-exporter/Chart.yaml
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore(helm): update chart and image versions to $RELEASE_VERSION"
git push origin HEAD:$RELEASE_BRANCH
fi