Skip to content

Commit

Permalink
refactor(docker): Roll our own push to GH package registry (#105)
Browse files Browse the repository at this point in the history
The official GH Action for this gets worse and worse with every version,
and the old versions aren't properly supported any more.

cf. docker/build-push-action#208

This isn't actually that hard, and with a make rule for it we have the
option to build and push locally.
  • Loading branch information
alerque committed Mar 16, 2021
1 parent 63ba001 commit 646ed11
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@ on:
- 'v*.*.*'

jobs:
ghpackages:

runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: docker.pkg.github.com
repository: sile-typesetter/casile/casile
tag_with_ref: true

ghrelease:

runs-on: ubuntu-20.04

ghpublish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -47,11 +30,20 @@ jobs:
name: casile-${{ env.VERSION }}
path: casile*-${{ env.VERSION }}.zip
- name: Publish Release
uses: softprops/action-gh-release@v0.1.5
uses: softprops/action-gh-release@v1
with:
body_path: casile-${{ env.VERSION }}.md
files: |
casile-${{ env.VERSION }}.zip
casile-${{ env.VERSION }}.tar.xz
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Publish Docker Image to GH Pakcages
run: |
make docker-build-push
env:
DOCKER_REGISTRY: docker.pkg.github.com
DOCKER_REPO: $GITHUB_REPOSITORY/casile
DOCKER_TAG: ${{ env.VERSION }}
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ github.token }}
13 changes: 12 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,17 @@ casile-%.md: CHANGELOG.md
sed -e '/\.\.\.v$*/,/\.\.\.v/!d' $< | \
sed -e '1,3d;N;$$!P;$$!D;$$d' > $@

export DOCKER_REGISTRY ?= docker.io
export DOCKER_REPO ?= siletypesetter/$(_casile)
export DOCKER_TAG ?= HEAD

.PHONY: docker
docker: Dockerfile hooks/build .version
IMAGE_NAME=siletypesetter/$(_casile):HEAD ./hooks/build $(VERSION)
./hooks/build $(VERSION)
docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG)


.PHONY: docker-build-push
docker-build-push: docker
docker login https://$(DOCKER_REGISTRY) -u $(DOCKER_USERNAME)
docker push $(DOCKER_REGISTRY)/$(DOCKER_REPO):$(DOCKER_TAG)
2 changes: 1 addition & 1 deletion hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ docker build \
--build-arg VCS_REF="${1:-$DESC}" \
--build-arg RUNTIME_DEPS="$RUNTIME_DEPS" \
--build-arg BUILD_DEPS="$BUILD_DEPS" \
--tag $IMAGE_NAME \
--tag $DOCKER_REPO:$DOCKER_TAG \
./

0 comments on commit 646ed11

Please sign in to comment.