Use inputs as env
This commit is contained in:
parent
1f87c20654
commit
2f1196a43b
|
@ -58,10 +58,9 @@ Docker :whale: image is also provided and automatically updated within [Docker H
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
if: success()
|
if: success()
|
||||||
uses: docker://crazymax/ghaction-github-pages
|
uses: docker://crazymax/ghaction-github-pages
|
||||||
with:
|
|
||||||
target_branch: gh-pages
|
|
||||||
build_dir: public
|
|
||||||
env:
|
env:
|
||||||
|
INPUT_TARGET_BRANCH: gh-pages
|
||||||
|
INPUT_BUILD_DIR: public
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
TARGET_BRANCH=$1
|
if [ -z "$INPUT_TARGET_BRANCH" ]; then
|
||||||
BUILD_DIR=$2
|
|
||||||
|
|
||||||
if [ -z "$TARGET_BRANCH" ]; then
|
|
||||||
echo "⛔️ Target branch not defined"
|
echo "⛔️ Target branch not defined"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$BUILD_DIR" ]; then
|
if [ ! -d "$INPUT_BUILD_DIR" ]; then
|
||||||
echo "⛔️ Build dir does not exist"
|
echo "⛔️ Build dir does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "🏃 Deploying $BUILD_DIR directory to $TARGET_BRANCH branch"
|
echo "🏃 Deploying $INPUT_BUILD_DIR directory to $INPUT_TARGET_BRANCH branch"
|
||||||
cd "$BUILD_DIR"
|
cd "$INPUT_BUILD_DIR"
|
||||||
|
|
||||||
git init
|
git init
|
||||||
git config user.name "${GITHUB_ACTOR}"
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
git add .
|
git add .
|
||||||
git commit --allow-empty -m 'Deploy to GitHub pages'
|
git commit --allow-empty -m 'Deploy to GitHub pages'
|
||||||
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:$TARGET_BRANCH
|
git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:${INPUT_TARGET_BRANCH}
|
||||||
rm -rf .git
|
rm -rf .git
|
||||||
|
|
||||||
cd "$GITHUB_WORKSPACE"
|
cd "$GITHUB_WORKSPACE"
|
||||||
echo "🎉 Content of $BUILD_DIR has been deployed to GitHub Pages."
|
echo "🎉 Content of $INPUT_BUILD_DIR has been deployed to GitHub Pages."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user