-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplugin-update-ciinabox-gitops.yml
More file actions
80 lines (66 loc) · 3.11 KB
/
Copy pathplugin-update-ciinabox-gitops.yml
File metadata and controls
80 lines (66 loc) · 3.11 KB
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
72
73
74
75
76
77
78
79
80
name: Update ciinabox-gitops-plugin
on:
schedule:
- cron: '0 6 * * *' # Daily at 6am UTC
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
pull-requests: write
jobs:
check-update:
name: Check for new ciinabox-gitops-plugin release
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Get latest release version
id: latest
run: |
LATEST=$(curl -sf https://s3-ap-southeast-2.amazonaws.com/base2.packages.ap-southeast-2.public/ciinabox/plugins/ciinabox-gitops-plugin.version)
echo "version=${LATEST}" >> "$GITHUB_OUTPUT"
echo "Latest release: ${LATEST}"
- name: Get current version from plugins.yaml
id: current
run: |
CURRENT=$(grep -A2 'artifactId: "ciinabox-gitops-plugin"' plugins.yaml | grep 'version:' | awk '{print $2}' | tr -d '"')
echo "version=${CURRENT}" >> "$GITHUB_OUTPUT"
echo "Current version: ${CURRENT}"
- name: Check if update needed
id: check
run: |
if [ "${{ steps.latest.outputs.version }}" != "${{ steps.current.outputs.version }}" ] && [ -n "${{ steps.latest.outputs.version }}" ]; then
echo "update=true" >> "$GITHUB_OUTPUT"
echo "Update available: ${{ steps.current.outputs.version }} -> ${{ steps.latest.outputs.version }}"
else
echo "update=false" >> "$GITHUB_OUTPUT"
echo "No update needed"
fi
- name: Update plugins.yaml
if: steps.check.outputs.update == 'true'
run: |
VERSION="${{ steps.latest.outputs.version }}"
S3_URL="https://s3-ap-southeast-2.amazonaws.com/base2.packages.ap-southeast-2.public/ciinabox/plugins/${VERSION}/ciinabox-gitops-plugin.hpi"
# Update version
sed -i "/artifactId: \"ciinabox-gitops-plugin\"/{n;n;s/version: .*/version: \"${VERSION}\"/}" plugins.yaml
# Update URL
sed -i "s|url: .*ciinabox-gitops-plugin.hpi.*|url: \"${S3_URL}\"|" plugins.yaml
echo "Updated plugins.yaml to version ${VERSION}"
grep -A3 'artifactId: "ciinabox-gitops-plugin"' plugins.yaml
- name: Create Pull Request
if: steps.check.outputs.update == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update ciinabox-gitops-plugin to ${{ steps.latest.outputs.version }}"
branch: auto/ciinabox-gitops-plugin-update
delete-branch: true
title: "Update ciinabox-gitops-plugin to ${{ steps.latest.outputs.version }}"
body: |
Automated update of `ciinabox-gitops-plugin` to version **${{ steps.latest.outputs.version }}**.
**Changes:** https://github.com/ciinabox/ciinabox-gitops-plugin/releases/tag/${{ steps.latest.outputs.version }}
Previous version: `${{ steps.current.outputs.version }}`
---
_This PR was created automatically by the daily plugin update workflow._
labels: |
dependencies
automated