Skip to content

Commit 41b0df2

Browse files
fix(ci): make build-mbgl-native workflow idempotent for re-runs
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
1 parent def0bfb commit 41b0df2

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

.github/workflows/build-mbgl-native.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ jobs:
2222
runs-on: ubuntu-latest
2323
timeout-minutes: 5
2424
steps:
25-
- name: Create draft release
25+
- name: Create draft release (skip if exists)
2626
run: |
27-
gh release create "$TAG_NAME" \
28-
--repo "${{ github.repository }}" \
29-
--title "mbgl-sys $TAG_NAME" \
30-
--notes "Pre-built MapLibre Native static libraries for mbgl-sys v${{ github.event.inputs.version }}" \
31-
--draft
27+
if gh release view "$TAG_NAME" --repo "${{ github.repository }}" >/dev/null 2>&1; then
28+
echo "Release $TAG_NAME already exists, skipping creation"
29+
else
30+
gh release create "$TAG_NAME" \
31+
--repo "${{ github.repository }}" \
32+
--title "mbgl-sys $TAG_NAME" \
33+
--notes "Pre-built MapLibre Native static libraries for mbgl-sys v${{ github.event.inputs.version }}" \
34+
--draft
35+
fi
3236
env:
3337
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3438

@@ -97,6 +101,7 @@ jobs:
97101
run: |
98102
gh release upload "$TAG_NAME" \
99103
--repo "${{ github.repository }}" \
104+
--clobber \
100105
"mbgl-native-${TARGET}.tar.gz"
101106
env:
102107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -196,6 +201,7 @@ jobs:
196201
run: |
197202
gh release upload "$TAG_NAME" \
198203
--repo "${{ github.repository }}" \
204+
--clobber \
199205
"mbgl-native-${TARGET}.tar.gz"
200206
env:
201207
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -206,10 +212,10 @@ jobs:
206212
needs: [build-macos, build-linux]
207213
timeout-minutes: 5
208214
steps:
209-
- name: Remove draft flag
215+
- name: Ensure release is published
210216
run: |
211217
gh release edit "$TAG_NAME" \
212218
--repo "${{ github.repository }}" \
213-
--draft=false
219+
--draft=false || true
214220
env:
215221
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)