Add workflow for running tests #192
Workflow file for this run
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: Image Builder | |
on: | |
push: {} | |
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' | |
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' | |
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' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Test image | |
run: make test IMAGE=${{ fromJSON(steps.meta.outputs.json).tags[0] }} |