mirror of
https://github.com/int128/kubelogin.git
synced 2026-05-23 16:22:48 +00:00
Use docker/metadata-action@v3 (#616)
This commit is contained in:
28
.github/docker-build-config.sh
vendored
28
.github/docker-build-config.sh
vendored
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -eux
|
||||
|
||||
# only build on pull request
|
||||
if [[ $GITHUB_EVENT_NAME == pull_request ]]; then
|
||||
# e.g. refs/pulls/1/merge -> refs-pulls-1-merge
|
||||
echo "::set-output name=tag::${GITHUB_REF//\//-}"
|
||||
echo "::set-output name=push::false"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# push latest tag on master branch
|
||||
if [[ $GITHUB_REF == refs/heads/master ]]; then
|
||||
echo "::set-output name=tag::latest"
|
||||
echo "::set-output name=push::true"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# push the corresponding tag on tag push
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
echo "::set-output name=tag::${GITHUB_REF##*/}"
|
||||
echo "::set-output name=push::true"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
: unknown trigger
|
||||
exit 1
|
||||
11
.github/workflows/docker.yaml
vendored
11
.github/workflows/docker.yaml
vendored
@@ -27,8 +27,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: .github/docker-build-config.sh
|
||||
id: docker-build-config
|
||||
- uses: docker/metadata-action@v3
|
||||
id: metadata
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
- uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
@@ -38,8 +40,9 @@ jobs:
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: ${{ steps.docker-build-config.outputs.push }}
|
||||
tags: ghcr.io/${{ github.repository }}:${{ steps.docker-build-config.outputs.tag }}
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildkit-cache
|
||||
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildkit-cache,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
Reference in New Issue
Block a user