Skip to content

Update docker/setup-buildx-action action to v3 (#78) #124

Update docker/setup-buildx-action action to v3 (#78)

Update docker/setup-buildx-action action to v3 (#78) #124

Workflow file for this run

---
name: Docker
"on":
push:
branches:
- main
pull_request:
jobs:
build:
name: Build and push
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile:
- Dockerfile.rust
steps:
- name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get image name from Dockerfile name
id: name
run: |
image_name=$(echo ${{ matrix.dockerfile }} | cut -d '.' -f 2)
echo "image_name=$image_name" >> $GITHUB_OUTPUT
echo "$image_name"
- name: Collect metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ steps.name.outputs.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
file: ${{ matrix.dockerfile }}
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}