From 77991bbc937d6c1d7777dc1e172aab46e5728b98 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Mon, 2 Sep 2019 18:28:50 +0900 Subject: [PATCH] add: release docker image with latest tag --- .github/workflows/docker-image-ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-image-ci.yml b/.github/workflows/docker-image-ci.yml index e9a750a..ee6ced1 100644 --- a/.github/workflows/docker-image-ci.yml +++ b/.github/workflows/docker-image-ci.yml @@ -15,7 +15,17 @@ jobs: - name: build if: github.event.deleted == false env: - DOCKER_IMAGE: ${{ github.repository }}:${{ github.sha }} + DOCKER_IMAGE: docker.pkg.github.com/${{ github.repository }}/action:latest run: | docker build . --file Dockerfile --tag ${DOCKER_IMAGE} || (echo -e "\e[31m[${GITHUB_WORKFLOW}] failed to build\e[m" && exit 1) + + - name: push latest image + if: success() && endsWith(github.ref, 'master') + env: + DOCKER_IMAGE: docker.pkg.github.com/${{ github.repository }}/action:latest + PKG_GITHUB_TOKEN: ${{ secrets.PKG_GITHUB_TOKEN }} + run: | + echo ${PKG_GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin && + docker push ${DOCKER_IMAGE} && + docker logout