1+ name : Update UI Plugin Charts Manifest
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ update-manifest :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : write
12+ pull-requests : write
13+ steps :
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+
17+ - name : Extract version from release
18+ id : extract_version
19+ run : |
20+ # Extract version from release tag (e.g., v1.6.0 -> 1.6.0)
21+ VERSION=${GITHUB_REF#refs/tags/v}
22+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
23+ echo "Extracted version: ${VERSION}"
24+
25+ - name : Checkout ui-plugin-charts repository
26+ uses : actions/checkout@v4
27+ with :
28+ repository : rancher/ui-plugin-charts
29+ token : ${{ secrets.ACCESS_UI_CHARTS_SECRET }}
30+ path : ui-plugin-charts
31+
32+ - name : Create branch for release
33+ run : |
34+ cd ui-plugin-charts
35+ git config user.name 'github-actions[bot]'
36+ git config user.email 'github-actions[bot]@users.noreply.github.com'
37+ BRANCH_NAME="release-harv-${{ steps.extract_version.outputs.version }}"
38+ git checkout -b "$BRANCH_NAME"
39+ echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
40+
41+ - name : Update manifest.json
42+ run : |
43+ cd ui-plugin-charts
44+
45+ # Read current manifest
46+ MANIFEST=$(cat manifest.json)
47+
48+ # Extract current harvester versions
49+ CURRENT_VERSIONS=$(echo "$MANIFEST" | jq -r '.extensions.harvester.versions[]')
50+
51+ # Check if version already exists
52+ if echo "$CURRENT_VERSIONS" | grep -q "^${{ steps.extract_version.outputs.version }}$"; then
53+ echo "Version ${{ steps.extract_version.outputs.version }} already exists in manifest.json"
54+ exit 0
55+ fi
56+
57+ # Add new version to the list and sort
58+ UPDATED_VERSIONS=$(echo "$CURRENT_VERSIONS"$'\n'"${{ steps.extract_version.outputs.version }}" | sort -V)
59+
60+ # Convert back to JSON array
61+ VERSIONS_JSON=$(echo "$UPDATED_VERSIONS" | jq -R . | jq -s .)
62+
63+ # Update manifest.json
64+ echo "$MANIFEST" | jq --argjson versions "$VERSIONS_JSON" '.extensions.harvester.versions = $versions' > manifest.json.tmp
65+ mv manifest.json.tmp manifest.json
66+
67+ echo "Updated manifest.json with version ${{ steps.extract_version.outputs.version }}"
68+
69+ - name : Commit and push changes
70+ run : |
71+ cd ui-plugin-charts
72+ git add manifest.json
73+ git commit -m "release harvester-ui-extension ${{ steps.extract_version.outputs.version }}"
74+ git push origin "$BRANCH_NAME"
75+
76+ - name : Create Pull Request
77+ uses : peter-evans/create-pull-request@v5
78+ with :
79+ token : ${{ secrets.ACCESS_UI_CHARTS_SECRET }}
80+ path : ui-plugin-charts
81+ branch : ${{ env.BRANCH_NAME }}
82+ title : " release harvester-ui-extension ${{ steps.extract_version.outputs.version }}"
83+ body : |
84+ This PR adds Harvester UI Extension version ${{ steps.extract_version.outputs.version }} to the manifest.json file.
85+
86+ **Changes:**
87+ - Added version `${{ steps.extract_version.outputs.version }}` to the Harvester extension versions list
88+
89+ **Release:** ${{ github.event.release.html_url }}
90+
91+ **Auto-generated by:** ${{ github.workflow }}
92+ base : main
93+ reviewers : |
94+ aalves08
95+ nwmac
0 commit comments