Skip to content

Commit f45b31e

Browse files
committed
Make NSC promotion release immutable
1 parent 79391e8 commit f45b31e

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/promote-nsc-channel.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ jobs:
5555
with:
5656
repository: ${{ inputs.target_repo }}
5757
ref: ${{ inputs.target_branch }}
58-
fetch-depth: 0
58+
fetch-depth: 1
59+
fetch-tags: false
5960
persist-credentials: false
6061
sparse-checkout: |
6162
tools/nsc/manifests
@@ -143,21 +144,28 @@ jobs:
143144
- source run: ${RUN_URL}
144145
EOF
145146
146-
if ! gh release view "${RELEASE_TAG}" --repo "${ASSET_REPO}" >/dev/null 2>&1; then
147+
release_exists=false
148+
if gh release view "${RELEASE_TAG}" --repo "${ASSET_REPO}" >/dev/null 2>&1; then
149+
release_exists=true
150+
fi
151+
152+
if [[ "${release_exists}" == "false" ]]; then
147153
gh release create "${RELEASE_TAG}" \
148154
--repo "${ASSET_REPO}" \
149155
--title "${RELEASE_TAG}" \
150156
--notes-file "${notes_file}"
151-
fi
152157
153-
mapfile -d '' payload_assets < <(find "${RUNNER_TEMP}/nsc-payload" -maxdepth 1 -type f -print0)
154-
if [[ "${#payload_assets[@]}" -eq 0 ]]; then
155-
echo "No payload assets found in ${RUNNER_TEMP}/nsc-payload" >&2
156-
exit 1
157-
fi
158+
mapfile -d '' payload_assets < <(find "${RUNNER_TEMP}/nsc-payload" -maxdepth 1 -type f -print0)
159+
if [[ "${#payload_assets[@]}" -eq 0 ]]; then
160+
echo "No payload assets found in ${RUNNER_TEMP}/nsc-payload" >&2
161+
exit 1
162+
fi
158163
159-
payload_assets+=("${manifests_zip}")
160-
gh release upload "${RELEASE_TAG}" "${payload_assets[@]}" --repo "${ASSET_REPO}" --clobber
164+
payload_assets+=("${manifests_zip}")
165+
gh release upload "${RELEASE_TAG}" "${payload_assets[@]}" --repo "${ASSET_REPO}"
166+
else
167+
echo "Release ${RELEASE_TAG} already exists in ${ASSET_REPO}. Reusing immutable release."
168+
fi
161169
162170
- name: Update manifests and tag pin
163171
id: manifest-diff

0 commit comments

Comments
 (0)