-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: improve workflows and Docker image (#314)
* ci: improve workflows and Docker image * chore: add vscode devcontainer
- Loading branch information
Showing
9 changed files
with
139 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "Node.js", | ||
"image": "docker.pkg.github.com/peaceiris/actions-label-commenter/alc-dev:latest", | ||
|
||
// Use 'settings' to set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash" | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created in the array below. | ||
"extensions": [ | ||
"bungcip.better-toml", | ||
"EditorConfig.EditorConfig", | ||
"donjayamanne.githistory", | ||
"eamodio.gitlens", | ||
"oderwat.indent-rainbow", | ||
"yzhang.markdown-all-in-one", | ||
"shd101wyy.markdown-preview-enhanced", | ||
"christian-kohler.path-intellisense", | ||
"lfs.vscode-emacs-friendly", | ||
"ms-azuretools.vscode-docker", | ||
"dbaeumer.vscode-eslint", | ||
"firsttris.vscode-jest-runner", | ||
"VisualStudioExptTeam.vscodeintellicode" | ||
], | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [3000], | ||
|
||
// Specifies a command that should be run after the container has been created. | ||
"postCreateCommand": "npm ci", | ||
|
||
// Comment out the next line to run as root instead. | ||
// "remoteUser": "runner" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 'Dev Image CI' | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '11 11 * * *' | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.github/workflows/dev-image.yml' | ||
- '.dockerignore' | ||
- '.nvmrc' | ||
- 'Dockerfile' | ||
- 'Makefile' | ||
- 'docker-compose.yml' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/dev-image.yml' | ||
- '.dockerignore' | ||
- '.nvmrc' | ||
- 'Dockerfile' | ||
- 'Makefile' | ||
- 'docker-compose.yml' | ||
|
||
jobs: | ||
skipci: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" | ||
|
||
dev-image-test: | ||
runs-on: ubuntu-18.04 | ||
if: contains(github.event.head_commit.message, '[skip ci]') == false | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Login to Packages | ||
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login 'docker.pkg.github.com' -u 'peaceiris' --password-stdin | ||
- run: docker-compose pull --quiet | ||
if: github.event_name == 'pull_request' | ||
- run: make build | ||
- run: docker images | ||
- run: make ci | ||
- run: make all | ||
- run: docker-compose push | ||
if: github.ref == 'refs/heads/main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,27 +10,6 @@ jobs: | |
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "${GITHUB_CONTEXT}" | ||
|
||
- name: Install github/hub | ||
run: | | ||
export HUB_VERSION="2.14.2" | ||
curl -fsSL https://github.com/github/hub/raw/8d91904208171b013f9a9d1175f4ab39068db047/script/get | bash -s "${HUB_VERSION}" | ||
- name: Create release | ||
- uses: peaceiris/workflows/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
TAG_NAME="${GITHUB_REF##refs/tags/}" | ||
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md | ||
RELEASE_NAME="$(jq -r '.name' ./package.json)" | ||
sed -i "1i${RELEASE_NAME} ${TAG_NAME}\n" ./release_notes.md | ||
./bin/hub release create \ | ||
--draft \ | ||
--prerelease \ | ||
--file ./release_notes.md \ | ||
"${TAG_NAME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
cmd := "bash" | ||
msg := "" | ||
IMAGE_NAME := actions_label_commenter_dev:latest | ||
IMAGE_NAME := docker.pkg.github.com/peaceiris/actions-label-commenter/alc-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) | ||
|
||
|
||
.PHONY: build | ||
build: | ||
$(DOCKER_BUILD) | ||
docker-compose build --build-arg NODE_VERSION=$(NODE_VERSION) | ||
|
||
.PHONY: run | ||
run: | ||
$(DOCKER_RUN) $(cmd) | ||
docker-compose run --rm dev bash | ||
|
||
.PHONY: ci | ||
ci: | ||
docker-compose run --rm -T dev npm ci | ||
|
||
.PHONY: test | ||
test: | ||
$(DOCKER_RUN) npm test | ||
docker-compose run --rm -T dev npm test | ||
|
||
.PHONY: commit | ||
commit: | ||
$(DOCKER_RUN) git commit -m "$(msg)" | ||
.PHONY: all | ||
all: | ||
docker-compose run --rm -T dev npm run all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3.2' | ||
|
||
services: | ||
dev: | ||
image: 'docker.pkg.github.com/peaceiris/actions-label-commenter/alc-dev:latest' | ||
build: | ||
context: . | ||
cache_from: | ||
- 'docker.pkg.github.com/peaceiris/actions-label-commenter/alc-dev:latest' | ||
container_name: peaceiris_actions_label_commenter | ||
volumes: | ||
- ${PWD}:/repo | ||
stdin_open: true | ||
tty: true | ||
command: | ||
- bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters