mirror of
https://github.com/int128/kubelogin.git
synced 2026-05-09 01:16:35 +00:00
76 lines
2.3 KiB
YAML
76 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
|
|
id: metadata
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
- uses: int128/docker-build-cache-config-action@4788c7e22b9923ca0e44bc7a29281b5beb545e5d # v1.49.0
|
|
id: cache
|
|
with:
|
|
image: ghcr.io/${{ github.repository }}/cache
|
|
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
|
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
- uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.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@4749ab599533d511736c2053f34b23a7aaced8c7 # v2.1.0
|
|
id: build-metadata
|
|
with:
|
|
tags: ${{ steps.metadata.outputs.tags }}
|
|
digest: ${{ steps.build.outputs.digest }}
|
|
|
|
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 }}
|