From 173c691211deed671a2eb69a8ecd7e5d21d6eff8 Mon Sep 17 00:00:00 2001 From: QP Hou Date: Mon, 7 Jun 2021 20:19:03 -0700 Subject: [PATCH] automate public docker image release (#15) --- .github/workflows/cicd.yml | 11 +++++++++++ Dockerfile | 1 + 2 files changed, 12 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ed8d4a5..7982e22 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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}" diff --git a/Dockerfile b/Dockerfile index 7dc364a..c6d2773 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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