ci: push dev docker image to packages (#384)

This commit is contained in:
Shohei Ueda 2020-07-09 05:33:46 +09:00 committed by GitHub
parent 2e976845a6
commit 29acb8eaee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -32,6 +32,12 @@ jobs:
if: contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- uses: actions/checkout@v2.3.1
- name: Login to Packages
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login 'docker.pkg.github.com' -u 'peaceiris' --password-stdin
- run: make pull
if: github.event_name == 'pull_request'
- run: make build
- run: make cirun cmd="npm ci"
- run: make ciall
- run: make push
if: github.ref == 'refs/heads/master'

View File

@ -1,15 +1,25 @@
cmd := "bash"
msg := ""
IMAGE_NAME := actions_github_pages_dev:latest
IMAGE_NAME := docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest
NODE_VERSION := $(shell cat ./.nvmrc)
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
.PHONY: build
build:
$(DOCKER_BUILD)
docker build . \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--cache-from=${IMAGE_NAME} \
-t $(IMAGE_NAME)
.PHONY: pull
pull:
docker pull ${IMAGE_NAME}
.PHONY: push
push:
docker push ${IMAGE_NAME}
.PHONY: run
run: