Bump actions/cache from 3 to 4 (#72) #19
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: DOCKER | |
on: | |
push: | |
# Trigger this workflow on changes to `main` | |
branches: [ main ] | |
# Trigger this workflow if a semver tag is pushed | |
tags: [ 'v*.*.*' ] | |
env: | |
# Our main, default container registry | |
GHC_REGISTRY: ghcr.io | |
# github.repository will be <account>/<repo>, for example, DEFRA/sroc-charging-module-api-tests | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Login against a GitHub Container registry | |
# https://github.com/docker/login-action | |
- name: Log into GH Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GHC_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.GHC_REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Build and push Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: production | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} |