Skip to content

Commit 9a31f0b

Browse files
committed
Adding condition before pushing the newly built image (2)...
1 parent 6ee4669 commit 9a31f0b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ jobs:
2828
- name: Log into registry
2929
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3030
run: |
31-
if [ -z "${{ secrets.GHCR_PAT }}" ]; then
32-
echo "GHCR_PAT is not set or unavailable in this context"
31+
TOKEN="$GHCR_PAT"
32+
if [ -z "$TOKEN" ]; then
33+
echo "GHCR_PAT is not available"
3334
exit 1
3435
fi
35-
echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
36+
echo "$TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
37+
env:
38+
GHCR_PAT: ${{ secrets.GHCR_PAT }}
3639

3740
- name: Push image
3841
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

0 commit comments

Comments
 (0)