2626 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2727 with :
2828 fetch-depth : 0
29+ persist-credentials : false
2930
3031 - name : Resolve target branches
3132 id : resolve-targets
@@ -35,14 +36,18 @@ jobs:
3536
3637 latest_branch=$(git ls-remote --heads origin | awk -F'/' '/refs\/heads\/1\.[0-9]+\.x$/ { print $NF }' | sort -V | tail -n 1)
3738 if [ -z "${latest_branch}" ]; then
38- echo "Unable to find a branch matching 1.d.x on origin" >&2
39- exit 1
39+ echo "No 1.x.x release branch found on origin; building from main only." >&2
4040 fi
4141
4242 timestamp=$(date '+%Y%m%d-%H%M%S')
4343 targets='[]'
4444
45- for branch in main "${latest_branch}"; do
45+ branches="main"
46+ if [ -n "${latest_branch}" ]; then
47+ branches="main ${latest_branch}"
48+ fi
49+
50+ for branch in ${branches}; do
4651 git fetch --depth=1 origin "${branch}:refs/remotes/origin/${branch}"
4752
4853 branch_version=$(git show "origin/${branch}:gradle.properties" | awk -F= '$1 == "version" { gsub(/^[[:space:]]+|[[:space:]]+$/, "", $2); gsub(/\r/, "", $2); print $2; exit }')
7782 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7883 with :
7984 ref : ${{ matrix.branch }}
85+ persist-credentials : false
8086
8187 - name : Set up JDK 21
8288 uses : actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
@@ -131,6 +137,7 @@ jobs:
131137 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
132138 with :
133139 ref : ${{ matrix.branch }}
140+ persist-credentials : false
134141
135142 - name : Set up JDK 21
136143 uses : actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
@@ -181,6 +188,7 @@ jobs:
181188 uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
182189 with :
183190 ref : ${{ matrix.branch }}
191+ persist-credentials : false
184192
185193 - name : Set up JDK 21
186194 uses : actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
@@ -209,7 +217,7 @@ jobs:
209217 env :
210218 packageUser : ${{ github.actor }}
211219 packagePAT : ${{ secrets.GITHUB_TOKEN }}
212- run : ./gradlew.bat build
220+ run : ./gradlew.bat -Pversion=${{ matrix.version }} build
213221
214222 # ─────────────────────────────────────────────────────────────────────────
215223 # Ballerina VSCode extension — build VSIX + tests
@@ -264,6 +272,8 @@ jobs:
264272 runs-on : ubuntu-latest
265273 steps :
266274 - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
275+ with :
276+ persist-credentials : false
267277 - name : " Failure Notification"
268278 uses : ./.github/actions/failure-notification
269279 with :
0 commit comments