Skip to content

Merge pull request #96 from mbanth/feature/prep_for_release #85

Merge pull request #96 from mbanth/feature/prep_for_release

Merge pull request #96 from mbanth/feature/prep_for_release #85

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Create and publish a Docker image
on:
push:
branches:
- 'develop'
tags:
- 'v*'
pull_request:
branches:
- 'develop'
# Allow manually triggering the workflow.
workflow_dispatch: {}
env:
REGISTRY: ghcr.io
IMAGE_NAME: xmos/fwk_io_tester
jobs:
changes:
runs-on: ubuntu-latest
name: Change detection
# Set job outputs to values from filter step
outputs:
dockerfile: ${{ steps.filter.outputs.dockerfile }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Paths filter
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
dockerfile:
- 'tools/docker/**'
build-and-push-image:
needs: changes
name: Build and push Docker image
if: ${{ needs.changes.outputs.dockerfile == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# vX.Y.Z vX.Y vX (on push tag)
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
# main/feature/etc
type=ref,event=branch
# pr-N
type=ref,event=pr
# sha-XXXXXXX
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
file: 'tools/docker/Dockerfile.tests'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}