diff options
Diffstat (limited to '.github/workflows/ghcr-auth.yaml')
-rw-r--r-- | .github/workflows/ghcr-auth.yaml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/.github/workflows/ghcr-auth.yaml b/.github/workflows/ghcr-auth.yaml new file mode 100644 index 0000000..a511827 --- /dev/null +++ b/.github/workflows/ghcr-auth.yaml @@ -0,0 +1,47 @@ +name: GHCR Authentication test + +on: + pull_request_target: + branches: ['main'] + push: + branches: ['main'] + +permissions: + contents: read + packages: read + +jobs: + krane: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.19 + check-latest: true + + - name: Install krane + working-directory: ./cmd/krane + run: go install . + + - name: Test krane + GHCR + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + # List the tags + krane ls ghcr.io/${{ github.repository }}/testimage + + - name: Test krane auth get + GHCR + env: + GITHUB_TOKEN: ${{ github.token }} + shell: bash + run: | + CRED1=$(krane auth get ghcr.io) + CRED2=$(krane auth get ghcr.io) + if [[ "$CRED1" == "" ]] ; then + exit 1 + fi + if [[ "$CRED1" == "$CRED2" ]] ; then + echo "credentials are cached by infrastructure" + fi + |