Skip to content

Update dependency pydantic to v2.10.4 (#414) #234

Update dependency pydantic to v2.10.4 (#414)

Update dependency pydantic to v2.10.4 (#414) #234

Workflow file for this run

name: Create and publish a Docker image
on:
workflow_dispatch: # Allow manually running
push:
# branches:
# - 'main'
# - 'dev'
tags:
- 'v*' # Run whenever a new tag is published
jobs:
# Run the tests before publishing Docker Image
call_tests:
name: Run Tests
uses: ./.github/workflows/test_docker_image.yml
secrets: inherit
push_to_registries:
name: Push Docker image
runs-on: ubuntu-latest
permissions: # Sets the permissions granted to the GITHUB_TOKEN for the actions in this job.
packages: write
contents: read
needs: [call_tests] # Will not run until tests have completed successfully
steps:
- uses: actions/checkout@v4
- name: Set up QEMU # Allow multi-arch (arm64) builds
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# This step uses docker/metadata-action to extract tags and labels that will be applied to the specified image. https://github.com/docker/metadata-action
# The id "meta" allows the output of this step to be referenced in a subsequent step. The images value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.6.1
with:
images: |
${{ github.repository }} # minituff/nautical-backup
ghcr.io/${{ github.repository }}
# This stage requires being run attached to a tag, otherwise it will use the branch name
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# output 0.1.2
type=semver,pattern={{version}}
# output 0.1
type=semver,pattern={{major}}.{{minor}}
# disabled if major zero
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Log in to Docker Hub
uses: docker/login-action@v3.3.0
with:
# This is your Docker Hub username and password.
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses the docker/build-push-action action to build the image, based on your repository's Dockerfile.
# It uses the context parameter to define the build's context as the set of files located in the specified path.
# For more information, see "Usage" in the README of the docker/build-push-action repository. https://github.com/docker/build-push-action#usage
# It uses the tags and labels parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker images
uses: docker/build-push-action@v6.10.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
NAUTICAL_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}