Skip to content

Commit

Permalink
Use ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
reijoh committed Mar 22, 2024
1 parent 1bac0c4 commit cd295fd
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/build-manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ jobs:
- name: Configure build
id: config
run: |
if [ 'schedule' = "${{ github.event_name }}" ]; then
pandoc_versions="['edge']"
stacks="['alpine','ubuntu','static']"
build=true
else
versions="'edge'"
pandoc_versions="[${versions}]"
stacks="'alpine'"
stacks="[${stacks}]"
build=true
fi
versions="'3.1.12'"
pandoc_versions="[${versions}]"
stacks="'alpine'"
stacks="[${stacks}]"
build=true
printf "Setting outputs:\n"
printf " - pandoc-versions: %s\n" "$pandoc_versions"
Expand Down Expand Up @@ -66,16 +60,32 @@ jobs:
if: ${{ matrix.stack != 'static' }}
run: make extra

- name: Publish freeze file on fail
if: failure()
uses: actions/upload-artifact@ef09cdac3e2d3e60d8ccadda691f4f1cec5035cb #v4.3.1 + 3 commits
with:
if-no-files-found: error
name: freeze-file
retention-days: 3
path: ${{ github.workspace }}/alpine/freeze/pandoc-3.1.12.project.freeze

- name: Test extra image
if: ${{ matrix.stack != 'static' }}
run: make test-extra

- name: Log into ghcr.io
if: >
github.event_name != 'pull_request' &&
github.repository == 'innofactororg/pandoc-dockerfiles'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push
if: github.repository == 'innofactororg/pandoc-dockerfiles'
if: >
github.event_name != 'pull_request' &&
github.repository == 'innofactororg/pandoc-dockerfiles'
run: |
# Log into registry
echo "${{ secrets.DOCKER_HUB_TOKEN }}" |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
if [ "$STACK" != 'static' ]; then
make push-extra
fi
make push-extra
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ freeze-file: $(STACK)/$(stack_freeze_file)
$(docker_cpu_options)
docker run --rm \
-v "$(makefile_dir):/app" \
--env WITHOUT_CROSSREF=$(WITHOUT_CROSSREF) \
reijoh/$(STACK)-builder-base:latest-$(STACK) \
--env WITHOUT_CROSSREF=true \
ghcr.io/innofactororg/$(STACK)-builder-base:latest-$(STACK) \
sh /app/common/pandoc-freeze.sh \
-c $(PANDOC_COMMIT) \
-u "$(shell id -u):$(shell id -g)" \
Expand Down Expand Up @@ -161,19 +161,19 @@ extra: $(STACK)/$(stack_freeze_file)
$(docker_cpu_options)
# Test ##################################################################
.PHONY: test-core test-extra test-latex test-minimal
test-minimal: IMAGE ?= reijoh/minimal:$(PANDOC_VERSION)-$(STACK)
test-minimal: IMAGE ?= ghcr.io/innofactororg/minimal:$(PANDOC_VERSION)-$(STACK)
test-minimal:
IMAGE=$(IMAGE) make -C test test-minimal

test-core: IMAGE ?= reijoh/core:$(PANDOC_VERSION)-$(STACK)
test-core: IMAGE ?= ghcr.io/innofactororg/core:$(PANDOC_VERSION)-$(STACK)
test-core:
test -n "$(WITHOUT_CROSSREF)" || IMAGE=$(IMAGE) make -C test test-core

test-latex: IMAGE ?= reijoh/latex:$(PANDOC_VERSION)-$(STACK)
test-latex: IMAGE ?= ghcr.io/innofactororg/latex:$(PANDOC_VERSION)-$(STACK)
test-latex:
IMAGE=$(IMAGE) make -C test test-latex

test-extra: IMAGE ?= reijoh/pandoc-extra:$(PANDOC_VERSION)-$(STACK)
test-extra: IMAGE ?= ghcr.io/innofactororg/pandoc-extra:$(PANDOC_VERSION)-$(STACK)
test-extra:
IMAGE=$(IMAGE) make -C test test-extra

Expand Down
8 changes: 5 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ fi

pandoc_version_opts=$(grep "^| *${pandoc_commit} *|" "$version_table_file")
if [ -z "$pandoc_version_opts" ]; then
printf 'Unsupported version: %s; aborting!\n' "$pandoc_commit" >&2
printf 'Unsupported version: %s; trying to create freeze file!\n' "$pandoc_commit" >&2
export PANDOC_VERSION="$pandoc_commit"
make alpine-freeze-file
exit 1
fi

Expand Down Expand Up @@ -167,9 +169,9 @@ is_default_stack_for_repo ()
image_name ()
{
if [ -z "$2" ]; then
printf 'reijoh/%s:%s' "$repo" "${1:-edge}"
printf 'ghcr.io/innofactororg/%s:%s' "$repo" "${1:-edge}"
else
printf 'reijoh/%s:%s-%s' "$repo" "${1:-edge}" "$2"
printf 'ghcr.io/innofactororg/%s:%s-%s' "$repo" "${1:-edge}" "$2"
fi
}

Expand Down
6 changes: 3 additions & 3 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# The IMAGE variable is required to be defined in order to `docker run` the
# various tests. The parent Makefile test targets define this, or alternatively
#
# 1. IMAGE=reijoh/image:tag make test-minimal
# 2. IMAGE=reijoh/image:tag make test-latex
# 3. IMAGE=reijoh/image:tag make test-extra
# 1. IMAGE=ghcr.io/innofactororg/image:tag make test-minimal
# 2. IMAGE=ghcr.io/innofactororg/image:tag make test-latex
# 3. IMAGE=ghcr.io/innofactororg/image:tag make test-extra
ifndef IMAGE
$(error IMAGE variable must be set to docker image to test)
endif
Expand Down

0 comments on commit cd295fd

Please sign in to comment.