Merge pull request #184 from jgilfoil/renovate/k3s-io-k3s-1.x #9
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: Update k3s Version in README | |
on: | |
push: | |
paths: | |
- 'kubernetes/apps/kube-system/system-upgrade-controller/ks.yaml' | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Extract KUBE_VERSION | |
id: extract-version | |
run: | | |
KUBE_VERSION=$(cat kubernetes/apps/kube-system/system-upgrade-controller/ks.yaml | grep 'KUBE_VERSION:' | cut -d ':' -f2 | xargs) | |
echo "KUBE_VERSION=$KUBE_VERSION" >> $GITHUB_ENV | |
- name: Update README.md | |
run: | | |
# Encode '+' as '%2B' for URL compatibility in the badge link | |
K3S_VERSION_ENCODED=$(echo "$KUBE_VERSION" | sed 's/\+/%2B/g') | |
K3S_VERSION="k3s-${K3S_VERSION_ENCODED}" | |
# Use the encoded version in the sed command to ensure proper matching and replacement | |
sed -i "s|k3s-v[0-9.]*%2Bk3s[0-9]*|$K3S_VERSION|g" README.md | |
- name: Commit and Push | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add README.md | |
git commit -m "Update k3s version badge to $KUBE_VERSION" | |
git push |