Bump docker/build-push-action from 5 to 6 #66
Workflow file for this run
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: test | |
on: | |
push: | |
branches: [master] | |
tags: ['**'] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
wemakeservices/caddy-gen | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
labels: | | |
org.opencontainers.image.licenses=MIT | |
- uses: docker/login-action@v3 | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- uses: docker/login-action@v3 | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: docker build | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
load: true | |
tags: caddy-gen:latest | |
- name: test | |
run: | | |
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --name caddy-gen caddy-gen:latest | |
sleep 5 # wait for container to start | |
./.github/workflows/test.sh | |
- name: docker push | |
uses: docker/build-push-action@v6 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |