Compare commits

...

8 Commits

Author SHA1 Message Date
peaceiris
f8dd9fac53 fix: Add skip function 2019-09-23 13:46:49 +09:00
peaceiris
2cc02d4c13 gha: Add pull_request trigger, close #32 2019-09-23 13:28:56 +09:00
peaceiris
6b5fd85f5d fix: INPUT_EMPTYCOMMITS false 2019-09-23 13:20:37 +09:00
peaceiris
bc2d1b14df feat: Add print_error 2019-09-22 16:21:48 +09:00
Shohei Ueda
deecf75ce0
Merge branch 'master' into fix/input-emptycommits 2019-09-22 16:18:24 +09:00
Shohei Ueda
45fd035794
Merge branch 'master' into fix/input-emptycommits 2019-09-22 14:42:09 +09:00
peaceiris
83bd255342 gha: Add fetch-depth 1 to actions/checkout 2019-09-22 12:35:59 +09:00
peaceiris
efee27b98b fix: Fixes #27 for docker hub image 2019-09-21 19:24:03 +09:00
2 changed files with 18 additions and 5 deletions

View File

@ -1,9 +1,12 @@
name: docker image ci name: docker image ci
on: on:
pull_request:
types: [opened, synchronize]
push: push:
paths: paths:
- '**' - '**'
- '.**'
- '!LICENSE' - '!LICENSE'
- '!README.md' - '!README.md'
- '!images' - '!images'
@ -14,6 +17,8 @@ jobs:
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
with:
fetch-depth: 1
- name: build - name: build
env: env:
@ -26,6 +31,8 @@ jobs:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
with:
fetch-depth: 1
- name: shellcheck - name: shellcheck
run: shellcheck ./entrypoint.sh run: shellcheck ./entrypoint.sh
@ -33,6 +40,8 @@ jobs:
runs-on: macOS-10.14 runs-on: macOS-10.14
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
with:
fetch-depth: 1
- name: hadolint - name: hadolint
run: | run: |
brew install hadolint brew install hadolint

View File

@ -11,6 +11,11 @@ function print_info() {
echo -e "\e[36mINFO: ${1}\e[m" echo -e "\e[36mINFO: ${1}\e[m"
} }
function skip() {
print_info "No changes detected, skipping deployment"
exit 0
}
# check values # check values
if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then
@ -32,6 +37,7 @@ elif [ -n "${PERSONAL_TOKEN}" ]; then
elif [ -n "${GITHUB_TOKEN}" ]; then elif [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN" print_info "setup with GITHUB_TOKEN"
print_error "Do not use GITHUB_TOKEN, See #9"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
@ -74,12 +80,10 @@ git add --all
print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}" print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}"
COMMIT_MESSAGE="Automated deployment: $(date -u) ${GITHUB_SHA}" COMMIT_MESSAGE="Automated deployment: $(date -u) ${GITHUB_SHA}"
if [[ ${INPUT_EMPTYCOMMITS} == "true" ]]; then if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then
git commit --allow-empty -m "${COMMIT_MESSAGE}" git commit -m "${COMMIT_MESSAGE}" || skip
else else
git commit -m "${COMMIT_MESSAGE}" || \ git commit --allow-empty -m "${COMMIT_MESSAGE}"
print_info "No changes detected, skipping deployment" && \
exit 0
fi fi
git push origin "${remote_branch}" git push origin "${remote_branch}"