...
1name: GHCR Authentication test
2
3on:
4 pull_request_target:
5 branches: ['main']
6 push:
7 branches: ['main']
8
9permissions:
10 contents: read
11 packages: read
12
13jobs:
14 krane:
15 runs-on: ubuntu-latest
16 steps:
17 - uses: actions/checkout@v3
18 - uses: actions/setup-go@v4
19 with:
20 go-version: 1.19
21 check-latest: true
22
23 - name: Install krane
24 working-directory: ./cmd/krane
25 run: go install .
26
27 - name: Test krane + GHCR
28 env:
29 GITHUB_TOKEN: ${{ github.token }}
30 run: |
31 # List the tags
32 krane ls ghcr.io/${{ github.repository }}/testimage
33
34 - name: Test krane auth get + GHCR
35 env:
36 GITHUB_TOKEN: ${{ github.token }}
37 shell: bash
38 run: |
39 CRED1=$(krane auth get ghcr.io)
40 CRED2=$(krane auth get ghcr.io)
41 if [[ "$CRED1" == "" ]] ; then
42 exit 1
43 fi
44 if [[ "$CRED1" == "$CRED2" ]] ; then
45 echo "credentials are cached by infrastructure"
46 fi
47
View as plain text