Skip to content

Commit ec80dfc

Browse files
Fixes in rel yml (#259)
1 parent f54c10c commit ec80dfc

2 files changed

Lines changed: 139 additions & 111 deletions

File tree

.github/workflows/delete-dev-releases.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ jobs:
2525

2626
- name: Delete releases and tags
2727
continue-on-error: true
28-
uses: dev-drprasad/delete-older-releases@653dc03d96473ac9e585c68c8bf5aaccb0dadb61 # 0.2.1
2928
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
with:
32-
keep_latest: 0
33-
delete_tag_pattern: "-${{inputs.tag}}"
34-
delete_tags: true
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GH_REPO: ${{ github.repository }}
31+
TAG: ${{ inputs.tag }}
32+
run: |
33+
set -euo pipefail
34+
35+
# Find every release whose tag name contains "-<input tag>"
36+
tags=$(gh release list --limit 1000 --json tagName \
37+
--jq ".[] | select(.tagName | contains(\"-${TAG}\")) | .tagName")
38+
39+
if [ -z "$tags" ]; then
40+
echo "No releases matching pattern '-${TAG}' found."
41+
exit 0
42+
fi
43+
44+
while IFS= read -r tag; do
45+
[ -z "$tag" ] && continue
46+
echo "Deleting release and tag: $tag"
47+
# --cleanup-tag also deletes the underlying git tag
48+
gh release delete "$tag" --yes --cleanup-tag
49+
done <<< "$tags"

.github/workflows/release.yml

Lines changed: 118 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ on:
3030
required: true
3131
type: string
3232

33+
permissions:
34+
id-token: write
35+
contents: write
36+
packages: write
37+
3338
jobs:
3439
deleteDevReleases:
3540
uses: Checkmarx/ast-eclipse-plugin/.github/workflows/delete-dev-releases.yml@main
@@ -38,15 +43,18 @@ jobs:
3843
secrets: inherit
3944
if: inputs.rbranch
4045
release:
46+
permissions:
47+
id-token: write
48+
contents: write
4149
runs-on: cx-public-ubuntu-x64
4250
outputs:
4351
TAG_NAME: ${{ steps.generate_tag_name.outputs.TAG_NAME }}
4452
CLI_VERSION: ${{ steps.set_outputs.outputs.CLI_VERSION }}
4553
steps:
4654
- name: Checkout
47-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
55+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
4856
with:
49-
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
57+
token: ${{ secrets.GITHUB_TOKEN }}
5058
lfs: true
5159

5260
- name: Checkout LFS objects
@@ -75,18 +83,23 @@ jobs:
7583
echo "TAG_NAME=$GH_RELEASE_TAG_NAME" >> $GITHUB_OUTPUT
7684
7785
- name: Set up JDK 17
78-
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
86+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
7987
with:
8088
distribution: temurin
8189
java-version: 17
8290

8391
- name: Cache local Maven repository
84-
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
92+
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3.5.0
8593
with:
8694
path: ~/.m2/repository
8795
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
8896
restore-keys: |
8997
${{ runner.os }}-maven-
98+
99+
- name: Configure echo mirror for dependency resolution
100+
run: |
101+
sed -i 's|</settings>|<mirrors><mirror><id>echo</id><mirrorOf>central</mirrorOf><url>https://maven.echohq.com</url></mirror></mirrors></settings>|' ~/.m2/settings.xml
102+
90103

91104
- name: Update the POM version.
92105
run: mvn -B org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion='${{ inputs.tag }}' --file pom.xml
@@ -106,115 +119,115 @@ jobs:
106119
echo "::set-output name=CLI_VERSION::${{ env.CLI_VERSION }}"
107120
108121
- name: Release
109-
uses: step-security/action-gh-release@277bfa82abcfdb73e5bbb19e213fd76532ee2be5 # v3.0.0
122+
uses: step-security/action-gh-release@277bfa82abcfdb73e5bbb19e213fd76532ee2be5 # v3.0.0
110123
with:
111124
tag_name: ${{ env.GH_RELEASE_TAG_NAME }}
112125
generate_release_notes: true
113126
files: ./com.checkmarx.eclipse.site/target/com.checkmarx.eclipse.site-*.zip
114127
prerelease: ${{ inputs.rbranch != '' && inputs.rbranch != null }}
115128

116-
- name: Git configuration
117-
run: |
118-
git config --global safe.directory "/tmp/**/*/"
119-
git config --global http.postBuffer 2097152000
120-
git config --global https.postBuffer 2097152000
121-
122-
- name: Ensure Git LFS is enabled
123-
run: |
124-
git lfs install
125-
git lfs track "plugins/*.jar" # Ensure large JARs are tracked
126-
git add .gitattributes
127-
git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit"
128-
129-
- name: Clone target repository and push changes via PR
130-
env:
131-
GH_TOKEN: ${{ secrets.ECLIPSE_SITE_TOKEN }}
132-
run: |
133-
# Clone the repository
134-
git clone https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
135-
cd update-site
136-
137-
# Ensure Git LFS is installed
138-
git lfs install
139-
140-
# Configure Git user to prevent commit errors
141-
git config --global user.email "cylon-bot@checkmarx.com"
142-
git config --global user.name "cylon-bot"
143-
144-
# Fetch all branches
145-
git fetch --all
146-
147-
# Ensure the branch exists and check it out
148-
if git show-ref --verify --quiet refs/remotes/origin/${{ env.GH_BRANCH_NAME }}; then
149-
echo "Branch ${{ env.GH_BRANCH_NAME }} exists remotely."
150-
git checkout -B ${{ env.GH_BRANCH_NAME }} origin/${{ env.GH_BRANCH_NAME }}
151-
else
152-
echo "Branch ${{ env.GH_BRANCH_NAME }} does not exist remotely."
153-
exit 1
154-
fi
155-
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 ====="
161-
ls -lh ../com.checkmarx.eclipse.site/target/repository/
162-
163-
# Copy new files without deleting .git directory
164-
rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./
165-
166-
# Debugging: List files in repository after copying
167-
echo "===== Files AFTER COPY ====="
168-
ls -lh .
169-
170-
# Dynamically track all .jar files in the plugins/ and features/ directories
171-
find plugins -name "*.jar" -exec git lfs track {} +
172-
find features -name "*.jar" -exec git lfs track {} +
173-
174-
# Ensure .gitattributes is added
175-
git add .gitattributes
176-
git add .
177-
178-
# Debugging: Show LFS-tracked files
179-
echo "===== Git LFS-tracked files ====="
180-
git lfs ls-files
181-
182-
git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" || echo "No changes to commit"
183-
184-
# Ensure the correct remote URL
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
129+
# - name: Git configuration
130+
# run: |
131+
# git config --global safe.directory "/tmp/**/*/"
132+
# git config --global http.postBuffer 2097152000
133+
# git config --global https.postBuffer 2097152000
134+
135+
# - name: Ensure Git LFS is enabled
136+
# run: |
137+
# git lfs install
138+
# git lfs track "plugins/*.jar" # Ensure large JARs are tracked
139+
# git add .gitattributes
140+
# git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit"
141+
142+
# - name: Clone target repository and push changes via PR
143+
# env:
144+
# GH_TOKEN: ${{ secrets.ECLIPSE_SITE_TOKEN }}
145+
# run: |
146+
# # Clone the repository
147+
# git clone https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/Checkmarx/ast-eclipse-plugin-update-site.git update-site
148+
# cd update-site
149+
150+
# # Ensure Git LFS is installed
151+
# git lfs install
152+
153+
# # # Configure Git user to prevent commit errors
154+
# # git config --global user.email ""
155+
# # git config --global user.name ""
156+
157+
# # Fetch all branches
158+
# git fetch --all
159+
160+
# # Ensure the branch exists and check it out
161+
# if git show-ref --verify --quiet refs/remotes/origin/${{ env.GH_BRANCH_NAME }}; then
162+
# echo "Branch ${{ env.GH_BRANCH_NAME }} exists remotely."
163+
# git checkout -B ${{ env.GH_BRANCH_NAME }} origin/${{ env.GH_BRANCH_NAME }}
164+
# else
165+
# echo "Branch ${{ env.GH_BRANCH_NAME }} does not exist remotely."
166+
# exit 1
167+
# fi
168+
169+
# # Create a feature branch
170+
# FEATURE_BRANCH="update-site/${{ env.GH_RELEASE_TAG_NAME }}"
171+
# git checkout -b "$FEATURE_BRANCH"
172+
173+
# echo "===== Files BEFORE COPY ====="
174+
# ls -lh ../com.checkmarx.eclipse.site/target/repository/
175+
176+
# # Copy new files without deleting .git directory
177+
# rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./
178+
179+
# # Debugging: List files in repository after copying
180+
# echo "===== Files AFTER COPY ====="
181+
# ls -lh .
182+
183+
# # Dynamically track all .jar files in the plugins/ and features/ directories
184+
# find plugins -name "*.jar" -exec git lfs track {} +
185+
# find features -name "*.jar" -exec git lfs track {} +
186+
187+
# # Ensure .gitattributes is added
188+
# git add .gitattributes
189+
# git add .
190+
191+
# # Debugging: Show LFS-tracked files
192+
# echo "===== Git LFS-tracked files ====="
193+
# git lfs ls-files
194+
195+
# git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" || echo "No changes to commit"
196+
197+
# # Ensure the correct remote URL
198+
# git remote set-url origin https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git
199+
200+
# # Push the feature branch
201+
# git push origin "$FEATURE_BRANCH"
202+
203+
# # Create PR with Jira ID at the end of the title
204+
# gh pr create \
205+
# --repo CheckmarxDev/ast-eclipse-plugin-update-site \
206+
# --base "${{ env.GH_BRANCH_NAME }}" \
207+
# --head "$FEATURE_BRANCH" \
208+
# --title "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" \
209+
# --body "Automated update of Eclipse update site for release ${{ env.GH_RELEASE_TAG_NAME }}."
210+
211+
# # Squash and merge the PR, then delete the branch
212+
# gh pr merge \
213+
# --repo CheckmarxDev/ast-eclipse-plugin-update-site \
214+
# --squash \
215+
# --auto \
216+
# --delete-branch
204217

205218

206219

207220

208-
notify:
209-
if: ${{ inputs.rbranch == '' || inputs.rbranch == null }}
210-
needs: release
211-
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
212-
with:
213-
product_name: Eclipse
214-
release_version: ${{ needs.release.outputs.TAG_NAME }}
215-
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
216-
release_author: "Phoenix Team"
217-
release_url: https://github.com/Checkmarx/ast-eclipse-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }}
218-
jira_product_name: ECLIPSE
219-
secrets: inherit
221+
# notify:
222+
# if: ${{ inputs.rbranch == '' || inputs.rbranch == null }}
223+
# needs: release
224+
# uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
225+
# with:
226+
# product_name: Eclipse
227+
# release_version: ${{ needs.release.outputs.TAG_NAME }}
228+
# cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
229+
# release_author: "Phoenix Team"
230+
# release_url: https://github.com/Checkmarx/ast-eclipse-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }}
231+
# jira_product_name: ECLIPSE
232+
# secrets: inherit
220233

0 commit comments

Comments
 (0)