Sync LTS Version #45145
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: Sync LTS Version | |
on: | |
schedule: | |
- cron: "0 * * * 3" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: next release version | |
id: nextversion | |
uses: jenkins-x-plugins/[email protected] | |
with: | |
previous-version: from-file:charts/jenkins/Chart.yaml | |
- name: Jenkins LTS version | |
id: lts | |
uses: jenkins-infra/[email protected] | |
with: | |
version-identifier: lts | |
- name: Check if update is available | |
id: update | |
run: | | |
CURRENT_VERSION=$(grep -E "^appVersion:" charts/jenkins/Chart.yaml | awk '{print $2}') | |
if [ "${CURRENT_VERSION}" = "${{ steps.lts.outputs.jenkins_version }}" ]; then | |
echo "available=false" >> "${GITHUB_OUTPUT}" | |
else | |
echo "available=true" >> "${GITHUB_OUTPUT}" | |
echo "current-version=${CURRENT_VERSION}" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: Update version in Chart.yaml | |
uses: mikefarah/[email protected] | |
if: ${{ steps.update.outputs.available == 'true' }} | |
with: | |
cmd: yq eval '.version = "${{ steps.nextversion.outputs.version }}"' -i charts/jenkins/Chart.yaml | |
- name: Update LTS version in files | |
if: ${{ steps.update.outputs.available == 'true' }} | |
run: | | |
grep -ilr ${{ steps.update.outputs.current-version }} charts/jenkins | grep -v CHANGELOG.md | xargs sed -i 's/${{ steps.update.outputs.current-version }}/${{ steps.lts.outputs.jenkins_version }}/g' | |
- name: Changelog | |
if: ${{ steps.update.outputs.available == 'true' }} | |
run: | | |
sed -i '/git commit to be able to get more details./a \\n## ${{ steps.nextversion.outputs.version }}\n\nUpdate Jenkins image and appVersion to jenkins lts release version ${{ steps.lts.outputs.jenkins_version }}\n' charts/jenkins/CHANGELOG.md | |
- name: Git Diff | |
if: ${{ steps.update.outputs.available == 'true' }} | |
run: | | |
git diff | |
# update the changelog | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_APP_ID }} | |
private_key: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_PRIVATE_KEY }} | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
if: ${{ steps.update.outputs.available == 'true' }} | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
commit-message: 'chore(deps): bump lts to ${{ steps.lts.outputs.jenkins_version }}' | |
author: jenkins-dependency-updater <81680575+jenkins-dependency-updater[bot]@users.noreply.github.com> | |
committer: jenkins-dependency-updater <81680575+jenkins-dependency-updater[bot]@users.noreply.github.com> | |
signoff: true | |
title: 'chore(deps): bump lts to ${{ steps.lts.outputs.jenkins_version }}' |