Add repo input

This commit is contained in:
CrazyMax 2019-10-03 03:16:44 +02:00
parent 068e494270
commit 08d0501ff9
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
3 changed files with 10 additions and 6 deletions

View File

@ -70,10 +70,11 @@ Docker :whale: image is also provided and automatically updated within [Docker H
Following inputs can be used as `step.with` keys
| Name | Type | Description |
|-----------------|---------|-----------------------------------------------------------------|
| `target_branch` | String | Git branch where assets will be deployed (default `gh-pages`) |
| `build_dir` | String | Path to build directory to deploy |
| Name | Type | Description |
|-----------------|---------|-----------------------------------------------------------------------------------------|
| `repo` | String | GitHub repository where assets will be deployed. Example: portapps/portapps.github.io |
| `target_branch` | String | Git branch where assets will be deployed (default `gh-pages`) |
| `build_dir` | String | Path to build directory to deploy |
### environment variables

View File

@ -7,9 +7,10 @@ branding:
icon: 'upload-cloud'
inputs:
repo:
description: 'GitHub repository where assets will be deployed. Example: portapps/portapps.github.io'
target_branch:
description: 'Git branch where assets will be deployed'
required: false
default: 'gh-pages'
build_dir:
description: 'Path to build directory to deploy'

View File

@ -1,6 +1,8 @@
#!/bin/sh
set -e
REPO=${INPUT_REPO:-$GITHUB_REPOSITORY}
if [ -z "$INPUT_TARGET_BRANCH" ]; then
echo "⛔️ Target branch not defined"
exit 1
@ -18,7 +20,7 @@ git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
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:${INPUT_TARGET_BRANCH}
git push --force --quiet "https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${REPO}.git" "master:${INPUT_TARGET_BRANCH}"
rm -rf .git
# Tried https://developer.github.com/v3/repos/pages/#request-a-page-build