|
39 | 39 | |
40 | 40 | with: |
41 | 41 | token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
| 42 | + lfs: true |
| 43 | + |
| 44 | + - name: Checkout LFS objects |
| 45 | + run: git lfs checkout |
42 | 46 |
|
43 | 47 | - name: Create Release Name |
44 | 48 | id: generate_tag_name |
@@ -106,18 +110,72 @@ jobs: |
106 | 110 | git config --global safe.directory "/tmp/**/*/" |
107 | 111 | git config --global http.postBuffer 2097152000 |
108 | 112 | git config --global https.postBuffer 2097152000 |
109 | | - |
110 | | - - name: Create update site |
111 | | - uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 #v.1.7.2 |
112 | | - env: |
113 | | - API_TOKEN_GITHUB: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
114 | | - with: |
115 | | - source-directory: './com.checkmarx.eclipse.site/target/repository/' |
116 | | - destination-github-username: 'cylon-bot' |
117 | | - destination-repository-username: 'CheckmarxDev' |
118 | | - destination-repository-name: 'ast-eclipse-plugin-update-site' |
119 | | - |
120 | | - target-branch: ${{ env.GH_BRANCH_NAME }} |
| 113 | +
|
| 114 | + - name: Ensure Git LFS is enabled |
| 115 | + run: | |
| 116 | + git lfs install |
| 117 | + git lfs track "plugins/*.jar" # Ensure large JARs are tracked |
| 118 | + git add .gitattributes |
| 119 | + git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit" |
| 120 | +
|
| 121 | + - name: Clone target repository and push changes |
| 122 | + run: | |
| 123 | + # 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 |
| 125 | + cd update-site |
| 126 | +
|
| 127 | + # Ensure Git LFS is installed |
| 128 | + git lfs install |
| 129 | +
|
| 130 | + # Configure Git user to prevent commit errors |
| 131 | + git config --global user.email "[email protected]" |
| 132 | + git config --global user.name "cylon-bot" |
| 133 | +
|
| 134 | + # Fetch all branches |
| 135 | + git fetch --all |
| 136 | +
|
| 137 | + # Ensure the branch exists and check it out |
| 138 | + if git show-ref --verify --quiet refs/remotes/origin/${{ env.GH_BRANCH_NAME }}; then |
| 139 | + echo "Branch ${{ env.GH_BRANCH_NAME }} exists remotely." |
| 140 | + git checkout -B ${{ env.GH_BRANCH_NAME }} origin/${{ env.GH_BRANCH_NAME }} |
| 141 | + else |
| 142 | + echo "Branch ${{ env.GH_BRANCH_NAME }} does not exist remotely." |
| 143 | + exit 1 |
| 144 | + fi |
| 145 | +
|
| 146 | + # Debugging: List files in repository before copying |
| 147 | + echo "===== Files in com.checkmarx.eclipse.site/target/repository/ BEFORE COPY =====" |
| 148 | + ls -lh ../com.checkmarx.eclipse.site/target/repository/ |
| 149 | +
|
| 150 | + # Copy new files without deleting .git directory |
| 151 | + rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./ |
| 152 | +
|
| 153 | + # Debugging: List files in repository after copying |
| 154 | + echo "===== Files in update-site/ AFTER COPY =====" |
| 155 | + ls -lh . |
| 156 | +
|
| 157 | + # Dynamically track all .jar files in the plugins/ and features/ directories |
| 158 | + find plugins -name "*.jar" -exec git lfs track {} + |
| 159 | + find features -name "*.jar" -exec git lfs track {} + |
| 160 | +
|
| 161 | + # Ensure .gitattributes is added |
| 162 | + git add .gitattributes |
| 163 | + git add . |
| 164 | +
|
| 165 | + # Debugging: Show LFS-tracked files |
| 166 | + echo "===== Git LFS-tracked files =====" |
| 167 | + git lfs ls-files |
| 168 | +
|
| 169 | + git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }}" || echo "No changes to commit" |
| 170 | +
|
| 171 | + # 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 }} |
| 176 | + |
| 177 | + |
| 178 | + |
121 | 179 |
|
122 | 180 | notify: |
123 | 181 | if: ${{ inputs.rbranch == '' || inputs.rbranch == null }} |
|
0 commit comments