-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
71 lines (62 loc) · 2.97 KB
/
sync-plugin-manager.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
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 }}'