Skip to content

Commit

Permalink
ci: push dev docker image to packages (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris authored Jul 8, 2020
1 parent 2e97684 commit 29acb8e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/dev-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
if: contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- uses: actions/[email protected]
- 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'
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 29acb8e

Please sign in to comment.