Skip to content

Commit 2f1196a

Browse files
committed
Use inputs as env
1 parent 1f87c20 commit 2f1196a

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Docker :whale: image is also provided and automatically updated within [Docker H
5858
- name: Deploy
5959
if: success()
6060
uses: docker://crazymax/ghaction-github-pages
61-
with:
62-
target_branch: gh-pages
63-
build_dir: public
6461
env:
62+
INPUT_TARGET_BRANCH: gh-pages
63+
INPUT_BUILD_DIR: public
6564
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6665
```
6766

entrypoint.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
#!/bin/sh
22
set -e
33

4-
TARGET_BRANCH=$1
5-
BUILD_DIR=$2
6-
7-
if [ -z "$TARGET_BRANCH" ]; then
4+
if [ -z "$INPUT_TARGET_BRANCH" ]; then
85
echo "⛔️ Target branch not defined"
96
exit 1
107
fi
11-
if [ ! -d "$BUILD_DIR" ]; then
8+
if [ ! -d "$INPUT_BUILD_DIR" ]; then
129
echo "⛔️ Build dir does not exist"
1310
exit 1
1411
fi
1512

16-
echo "🏃 Deploying $BUILD_DIR directory to $TARGET_BRANCH branch"
17-
cd "$BUILD_DIR"
13+
echo "🏃 Deploying $INPUT_BUILD_DIR directory to $INPUT_TARGET_BRANCH branch"
14+
cd "$INPUT_BUILD_DIR"
1815

1916
git init
2017
git config user.name "${GITHUB_ACTOR}"
2118
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2219
git add .
2320
git commit --allow-empty -m 'Deploy to GitHub pages'
24-
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:$TARGET_BRANCH
21+
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:${INPUT_TARGET_BRANCH}
2522
rm -rf .git
2623

2724
cd "$GITHUB_WORKSPACE"
28-
echo "🎉 Content of $BUILD_DIR has been deployed to GitHub Pages."
25+
echo "🎉 Content of $INPUT_BUILD_DIR has been deployed to GitHub Pages."

0 commit comments

Comments
 (0)