Bump docker/setup-buildx-action from 3.0.0 to 3.3.0 #280
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: main | |
push: | |
branches: main | |
permissions: | |
contents: read | |
packages: write | |
concurrency: | |
group: ci-${{github.ref}} | |
cancel-in-progress: ${{github.ref != 'refs/heads/main'}} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Gather info | |
id: info | |
run: | | |
PACKAGE='ghcr.io/${{github.repository_owner}}/clang-format' | |
TAGS="${PACKAGE}:latest" | |
echo "##[set-output name=package;]${PACKAGE,,}" | |
echo "##[set-output name=tags;]${TAGS,,}" | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up docker buildx | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
version: latest | |
- name: Set up cache | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{hashFiles('Dockerfile', '.dockerignore')}} | |
restore-keys: buildx- | |
- name: Build image | |
uses: docker/[email protected] | |
with: | |
builder: ${{steps.buildx.outputs.name}} | |
context: . | |
tags: ${{steps.info.outputs.tags}} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache | |
push: false | |
load: true | |
- name: Report image details | |
run: > | |
docker image history | |
--format "table {{.Size}}\t{{.CreatedBy}}" | |
${{steps.info.outputs.package}} | |
- name: Run tests | |
run: docker run ${{steps.info.outputs.package}} clang-format --version | |
- name: Login into registry | |
if: github.ref == 'refs/heads/main' | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{github.token}} | |
- name: Push image | |
if: github.ref == 'refs/heads/main' | |
uses: docker/[email protected] | |
with: | |
builder: ${{steps.buildx.outputs.name}} | |
context: . | |
tags: ${{steps.info.outputs.tags}} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache | |
push: true |