Skip to content

Sync Plugin manager Version #11382

Sync Plugin manager Version

Sync Plugin manager Version #11382

---
name: Sync Plugin manager Version
on:
schedule:
- cron: "* 23 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'jenkinsci'
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: PLUGIN_CLI_VERSION
id: lts
run: |
NEXT_VERSION=$(curl -sL https://api.github.com/repos/jenkinsci/plugin-installation-manager-tool/releases/latest | jq -r ".tag_name")
if [ -z "$NEXT_VERSION" ] || [ $NEXT_VERSION = "null" ]; then
echo "ERROR: Empty or 'null' latest plugin-installation-manager-tool version returned by GitHub API."
exit 1
fi
echo "next-version=$NEXT_VERSION" >> $GITHUB_OUTPUT
- name: Check if update is available
id: update
run: |
CURRENT_VERSION=$(docker buildx bake -f docker-bake.hcl --print alpine_jdk17 | jq -r ".target.alpine_jdk17.args.PLUGIN_CLI_VERSION")
if [ "$CURRENT_VERSION" = "${{ steps.lts.outputs.next-version }}" ]; then
echo "available=false" >> $GITHUB_OUTPUT
else
echo "available=true" >> $GITHUB_OUTPUT
echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
fi
- name: Update LTS version in files
if: ${{ steps.update.outputs.available == 'true' }}
run: |
grep -ilrF ${{ steps.update.outputs.current-version }} ./ | grep -v CHANGELOG.md | xargs sed -i 's/${{ steps.update.outputs.current-version }}/${{ steps.lts.outputs.next-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 plugin cli verions to jenkins plugin cli lts release version ${{ steps.lts.outputs.next-version }}\n' 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@v7
if: ${{ steps.update.outputs.available == 'true' }}
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: 'chore(deps): bump plugin manager to ${{ steps.lts.outputs.next-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
labels: 'dependencies'
title: 'chore(deps): bump plugin manager to ${{ steps.lts.outputs.next-version }}'