Skip to content

v0.21.3

v0.21.3 #20

name: Sync Config Schema
on:
release:
types:
- released
workflow_dispatch:
inputs:
releaseTag:
description: 'Release tag in form vX.Y.Z'
required: true
type: string
jobs:
sync:
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.release.outputs.latest_release }}
skip_update: ${{ steps.release.outputs.skip_update }}
steps:
# this is to support both manually trigger workflows, and automatically triggered on release creation
- name: Determine release tag
id: release
env:
MANUAL_TAG: ${{ inputs.releaseTag }}
run: |
if [[ -n "${MANUAL_TAG}" ]]; then
echo "Manually set tag: ${MANUAL_TAG}"
final_tag=${MANUAL_TAG}
else
echo "Tag from release event: ${{ github.event.release.tag_name }}"
final_tag=${{ github.event.release.tag_name }}
fi
echo "release_tag=${final_tag}" >> "$GITHUB_OUTPUT"
if [[ ${final_tag} == *"-beta."* || ${final_tag} == *"-alpha."* ]]; then
echo "skip_update=true" >> "$GITHUB_OUTPUT"
else
echo "skip_update=false" >> "$GITHUB_OUTPUT"
fi
- name: Checkout repo
if: ${{ steps.release.outputs.skip_update == 'false' }}
uses: actions/checkout@v4
with:
fetch-tags: 'true'
ref: 'refs/tags/${{ steps.release.outputs.release_tag }}'
- name: Configure git
if: ${{ steps.release.outputs.skip_update == 'false' }}
run: git config --global url.https://"$GH_ACCESS_TOKEN"@github.com/.insteadOf https://github.com/
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Set up Go
if: ${{ steps.release.outputs.skip_update == 'false' }}
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Skip updates on alpha or beta versions
if: ${{ steps.release.outputs.skip_update == 'true' }}
run: |
echo "skipping updates in vcluster schema, because the tag is alpha/beta: ${{ steps.release.outputs.release_tag }}"
- name: Update vcluster schema in vcluster-config
if: ${{ steps.release.outputs.skip_update == 'false' }}
run: |
git clone --single-branch https://github.com/loft-sh/vcluster-config.git
# copy generated schema from vcluster chart values to vcluster-config
cp chart/values.schema.json vcluster-config/values.schema.json
cd vcluster-config
git add --all
# if there are no changes, exit early
if git diff-index --quiet HEAD --; then
exit 0
fi
# set git info
git config --global user.name "Loft Bot"
git config --global user.email '[email protected]'
echo "Changes detected"
# commit changes
git commit -m "chore: sync values.schema.json to vCluster version ${{ steps.release.outputs.release_tag }}"
git push -u origin -f main
echo "vcluster-config values.schema.json updated to the version ${{ steps.release.outputs.release_tag }}"