Skip to content

Commit 29acb8e

Browse files
authored
ci: push dev docker image to packages (#384)
1 parent 2e97684 commit 29acb8e

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/dev-image.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
if: contains(github.event.head_commit.message, '[skip ci]') == false
3333
steps:
3434
- uses: actions/[email protected]
35+
- name: Login to Packages
36+
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login 'docker.pkg.github.com' -u 'peaceiris' --password-stdin
37+
- run: make pull
38+
if: github.event_name == 'pull_request'
3539
- run: make build
3640
- run: make cirun cmd="npm ci"
3741
- run: make ciall
42+
- run: make push
43+
if: github.ref == 'refs/heads/master'

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
cmd := "bash"
22
msg := ""
3-
IMAGE_NAME := actions_github_pages_dev:latest
3+
IMAGE_NAME := docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest
44
NODE_VERSION := $(shell cat ./.nvmrc)
5-
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
65
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
76
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
87

98

109
.PHONY: build
1110
build:
12-
$(DOCKER_BUILD)
11+
docker build . \
12+
--build-arg NODE_VERSION=$(NODE_VERSION) \
13+
--cache-from=${IMAGE_NAME} \
14+
-t $(IMAGE_NAME)
15+
16+
.PHONY: pull
17+
pull:
18+
docker pull ${IMAGE_NAME}
19+
20+
.PHONY: push
21+
push:
22+
docker push ${IMAGE_NAME}
1323

1424
.PHONY: run
1525
run:

0 commit comments

Comments
 (0)