automate public docker image release (#15)

This commit is contained in:
QP Hou 2021-06-07 20:19:03 -07:00 committed by GitHub
parent 5bc094bc1e
commit 173c691211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,10 @@ jobs:
- name: Run test
run: make test
- name: Test Docker build
run: docker build --rm -t ghcr.io/scribd/objinsync:latest .
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
@ -53,3 +57,10 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish docker image
run: |
VERSION=${GITHUB_REF##*/}
echo ${SCRIBDBOT_GH_CONTAINER_REGISTRY_TOKEN} | docker login ghcr.io -u scribdbot --password-stdin
docker build --rm -t "ghcr.io/scribd/objinsync:${VERSION}" .
docker push "ghcr.io/scribd/objinsync:${VERSION}"

View File

@ -1,4 +1,5 @@
FROM golang:1.16.3 as build
LABEL org.opencontainers.image.source https://github.com/scribd/objinsync
ADD . /app
WORKDIR /app