Skip to content

Refactor and document testing #231

Refactor and document testing

Refactor and document testing #231

Workflow file for this run

name: Image Builder
on:
push:
paths-ignore:
- '.gitignore'
- 'CHANGELOG.md'
- 'LICENSE'
- 'README.md'
pull_request:
branches:
- main
jobs:
# Build images and push them
build:
name: Build tagged Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
if: >-
github.repository == 'openjournals/inara' &&
github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: >-
github.repository == 'openjournals/inara' &&
github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
openjournals/inara
ghcr.io/openjournals/inara
tags: |
type=semver,pattern={{version}}
type=edge
type=ref,event=branch
type=ref,event=pr
- name: Build and maybe push image
id: push
uses: docker/build-push-action@v5
with:
context: '.'
push: ${{ github.ref == 'refs/heads/main' ||
github.ref_type == 'tag' ||
github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test image
run: make test IMAGE=${{ fromJSON(steps.meta.outputs.json).tags[0] }}