mirror of
https://github.com/int128/kubelogin.git
synced 2026-02-14 16:39:51 +00:00
75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
name: docker
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- .github/workflows/docker.yaml
|
|
- pkg/**
|
|
- go.*
|
|
- Dockerfile
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- .github/workflows/docker.yaml
|
|
- pkg/**
|
|
- go.*
|
|
- Dockerfile
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
outputs:
|
|
image-uri: ${{ steps.build-metadata.outputs.image-uri }}
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
|
|
id: metadata
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- uses: int128/docker-build-cache-config-action@622932dfa73db7d3a65e40d5fcc094f2101e659a # v1.37.0
|
|
id: cache
|
|
with:
|
|
image: ghcr.io/${{ github.repository }}/cache
|
|
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
|
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
|
- uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
|
|
id: build
|
|
with:
|
|
push: ${{ github.event_name == 'push' }}
|
|
tags: ${{ steps.metadata.outputs.tags }}
|
|
labels: ${{ steps.metadata.outputs.labels }}
|
|
cache-from: ${{ steps.cache.outputs.cache-from }}
|
|
cache-to: ${{ steps.cache.outputs.cache-to }}
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
linux/ppc64le
|
|
- uses: int128/docker-build-metadata-action@fac3c879c58b212e339c5e959cabb865cbee0c6e # v1.0.0
|
|
id: build-metadata
|
|
with:
|
|
metadata: ${{ steps.build.outputs.metadata }}
|
|
|
|
test:
|
|
if: needs.build.outputs.image-uri != ''
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- run: docker run --rm "$IMAGE_URI" --help
|
|
env:
|
|
IMAGE_URI: ${{ needs.build.outputs.image-uri }}
|