Skip to content

Commit 4332142

Browse files
committed
Update action and script
1 parent 26ac50c commit 4332142

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Deploy GitHub Pages site'
2-
description: 'A GitHub Action to deploy an artifact as a GitHub Pages site'
1+
name: 'Deploy multi-version documentation to GitHub Pages'
2+
description: 'A GitHub Action to deploy multi-version documentation to GitHub Pages'
33
author: 'Michael Yan'
44
branding:
55
icon: 'award'

main.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
if [ -z "$GH_TOKEN" ]
5+
if [ -z "$TOKEN" ]
66
then
77
echo "You must provide the action with a GitHub Personal Access Token secret in order to deploy."
88
exit 1
@@ -56,7 +56,7 @@ git config --global http.version HTTP/1.1
5656
git config --global http.postBuffer 157286400
5757

5858
## Initializes the repository path using the access token.
59-
REPOSITORY_PATH="https://${GH_TOKEN}@github.com/${TARGET_REPOSITORY}.git" && \
59+
REPOSITORY_PATH="https://${TOKEN}@github.com/${TARGET_REPOSITORY}.git" && \
6060

6161
# Checks to see if the remote exists prior to deploying.
6262
# If the branch doesn't exist it gets created here as an orphan.
@@ -71,7 +71,7 @@ then
7171
touch README.md && \
7272
git add README.md && \
7373
git commit -m "Initial ${BRANCH} commit" && \
74-
git push "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$TARGET_REPOSITORY.git" $BRANCH
74+
git push "https://$GITHUB_ACTOR:$TOKEN@github.com/$TARGET_REPOSITORY.git" $BRANCH
7575
else
7676
## Clone the target repository
7777
git clone "$REPOSITORY_PATH" $DOC_FOLDER --branch $BRANCH --single-branch && \
@@ -93,15 +93,14 @@ fi
9393
# Commits the data to Github.
9494
if [ -z "$VERSION" ]
9595
then
96-
echo "No Version. Publishing Snapshot of Docs"
96+
echo "No Version. Publishing Docs to Root"
9797
if [ -n "${DOC_SUB_FOLDER}" ]; then
98-
mkdir -p snapshot/$DOC_SUB_FOLDER
99-
cp -r "../$FOLDER/." ./snapshot/$DOC_SUB_FOLDER/
100-
git add snapshot/$DOC_SUB_FOLDER/*
98+
mkdir -p $DOC_SUB_FOLDER
99+
cp -r "../$FOLDER/." ./$DOC_SUB_FOLDER/
100+
git add $DOC_SUB_FOLDER/*
101101
else
102-
mkdir -p snapshot
103-
cp -r "../$FOLDER/." ./snapshot/
104-
git add snapshot/*
102+
cp -r "../$FOLDER/." ./
103+
git add *
105104
fi
106105
else
107106
echo "Publishing $VERSION of Docs"
@@ -145,5 +144,5 @@ fi
145144

146145

147146
git commit -m "Deploying to ${BRANCH} - $(date +"%T")" --quiet && \
148-
git push "https://$GITHUB_ACTOR:$GH_TOKEN@github.com/$TARGET_REPOSITORY.git" $BRANCH || true && \
147+
git push "https://$GITHUB_ACTOR:$TOKEN@github.com/$TARGET_REPOSITORY.git" $BRANCH || true && \
149148
echo "Deployment successful!"

0 commit comments

Comments
 (0)