Skip to content

Commit

Permalink
CI: test the image built in this action
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Jun 10, 2024
1 parent 30eaf88 commit 4abb76f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
38 changes: 24 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Image Builder

on:
push: {}
push:
# branch: main

jobs:
# Build images and push them
Expand Down Expand Up @@ -36,16 +37,25 @@ jobs:
ghcr.io/openjournals/inara
tags: |
type=semver,pattern={{version}}
type=edge,branch=main
- name: Build and push image
id: push
uses: docker/build-push-action@v5
with:
context: '.'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Test image
run: make test
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' }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

# - name: Test image
# run: make test IMAGE=${{ steps.meta.outputs.tags[0] }}

- name: Funny stuff
run: |
echo "tags"
echo "${{ steps.meta.outputs.tags }}"
echo "fromjson.tags[0]"
echo "${{ fromJSON(steps.meta.outputs.json).tags[0] }}"
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ TARGET_FOLDER = publishing-artifacts

ARTICLE_INFO_FILE = $(OPENJOURNALS_PATH)/default-article-info.yaml

IMAGE = openjournals/inara:edge

.PHONY: all
all: cff pdf html jats crossref native preprint

Expand Down Expand Up @@ -48,7 +50,7 @@ $(TARGET_FOLDER):

.PHONY: docker-image
docker-image: Dockerfile
docker build --tag openjournals/inara:edge .
docker build --tag $(IMAGE) .

push-docker-image:
docker push openjournals/inara
Expand Down Expand Up @@ -92,7 +94,7 @@ clean:
INARA_TEST_CMD = docker run --rm \
--user $(shell id -u):$(shell id -g) \
--env SOURCE_DATE_EPOCH=1234567890 \
-v $${PWD}:/data openjournals/inara:edge
-v $${PWD}:/data $(IMAGE)

.PHONY: test test-golden-draft test-golden-pub
test: test-golden-draft test-golden-pub
Expand Down

0 comments on commit 4abb76f

Please sign in to comment.