Skip to content

Commit 1b94a50

Browse files
Updated release workflow to take the jira ticket (#242)
* Updated release workflow to take the jira ticket * Commented the merge to test * Un commented the merge to test
1 parent 08d6b8b commit 1b94a50

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: 'Branch to publish development releases'
1212
required: false
1313
type: string
14+
jira_ticket:
15+
description: 'Jira ticket ID (e.g. AST-12345)'
16+
required: true
17+
type: string
1418
workflow_dispatch:
1519
inputs:
1620
tag:
@@ -21,6 +25,10 @@ on:
2125
description: 'Branch to publish development releases'
2226
required: false
2327
type: string
28+
jira_ticket:
29+
description: 'Jira ticket ID (e.g. AST-12345)'
30+
required: true
31+
type: string
2432

2533
jobs:
2634
deleteDevReleases:
@@ -118,10 +126,12 @@ jobs:
118126
git add .gitattributes
119127
git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit"
120128
121-
- name: Clone target repository and push changes
129+
- name: Clone target repository and push changes via PR
130+
env:
131+
GH_TOKEN: ${{ secrets.ECLIPSE_SITE_TOKEN }}
122132
run: |
123133
# Clone the repository
124-
git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
134+
git clone https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
125135
cd update-site
126136
127137
# Ensure Git LFS is installed
@@ -143,15 +153,18 @@ jobs:
143153
exit 1
144154
fi
145155
146-
# Debugging: List files in repository before copying
147-
echo "===== Files in com.checkmarx.eclipse.site/target/repository/ BEFORE COPY ====="
156+
# Create a feature branch
157+
FEATURE_BRANCH="update-site/${{ env.GH_RELEASE_TAG_NAME }}"
158+
git checkout -b "$FEATURE_BRANCH"
159+
160+
echo "===== Files BEFORE COPY ====="
148161
ls -lh ../com.checkmarx.eclipse.site/target/repository/
149162
150163
# Copy new files without deleting .git directory
151164
rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./
152165
153166
# Debugging: List files in repository after copying
154-
echo "===== Files in update-site/ AFTER COPY ====="
167+
echo "===== Files AFTER COPY ====="
155168
ls -lh .
156169
157170
# Dynamically track all .jar files in the plugins/ and features/ directories
@@ -166,13 +179,28 @@ jobs:
166179
echo "===== Git LFS-tracked files ====="
167180
git lfs ls-files
168181
169-
git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }}" || echo "No changes to commit"
182+
git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" || echo "No changes to commit"
170183
171184
# Ensure the correct remote URL
172-
git remote set-url origin https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git
173-
174-
# Push changes
175-
git push origin ${{ env.GH_BRANCH_NAME }}
185+
git remote set-url origin https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git
186+
187+
# Push the feature branch
188+
git push origin "$FEATURE_BRANCH"
189+
190+
# Create PR with Jira ID at the end of the title
191+
gh pr create \
192+
--repo CheckmarxDev/ast-eclipse-plugin-update-site \
193+
--base "${{ env.GH_BRANCH_NAME }}" \
194+
--head "$FEATURE_BRANCH" \
195+
--title "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" \
196+
--body "Automated update of Eclipse update site for release ${{ env.GH_RELEASE_TAG_NAME }}."
197+
198+
# Squash and merge the PR, then delete the branch
199+
gh pr merge \
200+
--repo CheckmarxDev/ast-eclipse-plugin-update-site \
201+
--squash \
202+
--auto \
203+
--delete-branch
176204
177205

178206

0 commit comments

Comments
 (0)