Add latest release of actions and with a context

This commit is contained in:
Laurent Indermuehle 2023-01-20 09:53:05 +01:00
parent a849f92e2e
commit f663ee6fb9
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09

View file

@ -7,11 +7,12 @@ on:
- main - main
- lie_tests_using_containers - lie_tests_using_containers
paths: paths:
- 'test-containers/mariadb103-py38-mysqlclient201/**' - '${{ env.CONTEXT }}/**'
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
IMAGE_NAME: mariadb103-py38-mysqlclient201 IMAGE_NAME: ${{ github.actor }}/test-container-mariadb103-py38-mysqlclient201
CONTEXT: test-containers/mariadb103-py38-mysqlclient201
jobs: jobs:
@ -39,31 +40,33 @@ jobs:
# with: # with:
# cosign-release: 'v1.11.0' # cosign-release: 'v1.11.0'
# Login against a Docker registry
# https://github.com/docker/login-action # https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }} - name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c uses: docker/login-action@v2
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action # https://github.com/docker/metadata-action
- name: Extract Docker metadata - name: Extract Docker metadata (tags, labels)
id: meta id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 uses: docker/metadata-action@v4
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx # Setting up Docker Buildx with docker-container driver is required
# at the moment to be able to use a subdirectory with Git context
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
- name: Build and push Docker image - name: Build and push Docker image with Buildx
id: build-and-push id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a uses: docker/build-push-action@v3
with: with:
context: . context: ${{ env.CONTEXT }}
push: ${{ github.event_name == 'push' }} push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha