This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
chore(deps): update nicolaiunrein/cargo-get digest to 47e673a #112
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: build-docker | |
concurrency: | |
cancel-in-progress: true | |
group: build-docker-${{ github.event.pull_request.number || github.sha }} | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image-repo: ${{ github.repository }} | |
dockerfile: Dockerfile | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU needed for Docker | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
logout: false | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
- id: readme | |
name: Read README | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: README.md | |
- name: Login to Docker hub | |
uses: docker/login-action@v3 | |
with: | |
logout: false | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
registry: docker.io | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
- id: meta | |
name: Docker metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.REGISTRY }}/${{ matrix.image-repo }} | |
labels: | | |
org.opencontainers.image.description: ${{ steps.readme.outputs.content }} | |
- id: short-sha | |
name: Set image tag | |
run: | | |
echo "short-sha=$(echo ${{ github.sha }} | cut -c 1-7 )" >> $GITHUB_OUTPUT | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
file: ${{ matrix.dockerfile }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: | | |
${{ env.REGISTRY }}/${{ matrix.image-repo }}:${{ steps.short-sha.outputs.short-sha }} | |
${{ env.REGISTRY }}/${{ matrix.image-repo }}:latest | |
${{ matrix.image-repo }}:${{ steps.short-sha.outputs.short-sha }} | |
${{ matrix.image-repo }}:latest |