Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 38 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
description: 'Branch to publish development releases'
required: false
type: string
jira_ticket:
description: 'Jira ticket ID (e.g. AST-12345)'
required: true
type: string
workflow_dispatch:
inputs:
tag:
Expand All @@ -21,6 +25,10 @@ on:
description: 'Branch to publish development releases'
required: false
type: string
jira_ticket:
description: 'Jira ticket ID (e.g. AST-12345)'
required: true
type: string

jobs:
deleteDevReleases:
Expand Down Expand Up @@ -118,10 +126,12 @@ jobs:
git add .gitattributes
git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit"

- name: Clone target repository and push changes
- name: Clone target repository and push changes via PR
env:
GH_TOKEN: ${{ secrets.ECLIPSE_SITE_TOKEN }}
run: |
# Clone the repository
git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
git clone https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
cd update-site

# Ensure Git LFS is installed
Expand All @@ -143,15 +153,18 @@ jobs:
exit 1
fi

# Debugging: List files in repository before copying
echo "===== Files in com.checkmarx.eclipse.site/target/repository/ BEFORE COPY ====="
# Create a feature branch
FEATURE_BRANCH="update-site/${{ env.GH_RELEASE_TAG_NAME }}"
git checkout -b "$FEATURE_BRANCH"

echo "===== Files BEFORE COPY ====="
ls -lh ../com.checkmarx.eclipse.site/target/repository/

# Copy new files without deleting .git directory
rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./

# Debugging: List files in repository after copying
echo "===== Files in update-site/ AFTER COPY ====="
echo "===== Files AFTER COPY ====="
ls -lh .

# Dynamically track all .jar files in the plugins/ and features/ directories
Expand All @@ -166,13 +179,28 @@ jobs:
echo "===== Git LFS-tracked files ====="
git lfs ls-files

git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }}" || echo "No changes to commit"
git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" || echo "No changes to commit"

# Ensure the correct remote URL
git remote set-url origin https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git

# Push changes
git push origin ${{ env.GH_BRANCH_NAME }}
git remote set-url origin https://x-access-token:${{ secrets.ECLIPSE_SITE_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git

# Push the feature branch
git push origin "$FEATURE_BRANCH"

# Create PR with Jira ID at the end of the title
gh pr create \
--repo CheckmarxDev/ast-eclipse-plugin-update-site \
--base "${{ env.GH_BRANCH_NAME }}" \
--head "$FEATURE_BRANCH" \
--title "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" \
--body "Automated update of Eclipse update site for release ${{ env.GH_RELEASE_TAG_NAME }}."

# Squash and merge the PR, then delete the branch
gh pr merge \
--repo CheckmarxDev/ast-eclipse-plugin-update-site \
--squash \
--auto \
--delete-branch



Expand Down
Loading