fix(ci): update image existence check to use GitHub token for authentication
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
This commit is contained in:
@@ -66,10 +66,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Check if image exists in GHCR
|
- name: Check if image exists in GHCR
|
||||||
id: image-check
|
id: image-check
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# Exchange the GitHub token for a GHCR registry JWT
|
||||||
|
TOKEN=$(curl -s \
|
||||||
|
-u "${{ github.actor }}:${GH_TOKEN}" \
|
||||||
|
"https://ghcr.io/token?scope=repository:now-chess/now-chess-systems/${{ matrix.module }}:pull&service=ghcr.io" \
|
||||||
|
| jq -r .token)
|
||||||
|
|
||||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: Bearer ${TOKEN}" \
|
||||||
"https://ghcr.io/v2/now-chess/now-chess-systems/${{ matrix.module }}/manifests/${{ steps.version.outputs.version }}")
|
"https://ghcr.io/v2/now-chess/now-chess-systems/${{ matrix.module }}/manifests/${{ steps.version.outputs.version }}")
|
||||||
|
|
||||||
if [[ "$STATUS" == "200" ]]; then
|
if [[ "$STATUS" == "200" ]]; then
|
||||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user