-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afad96a
commit 9d3df04
Showing
1 changed file
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,21 @@ jobs: | |
steps: | ||
|
||
- name: Get branch name | ||
run: echo ${GITHUB_REF##*/} | ||
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
|
||
- name: Echo branch name and check if it's the default branch | ||
run: | | ||
echo "Current Branch: $BRANCH_NAME" | ||
DEFAULT_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') | ||
echo "Default Branch: $DEFAULT_BRANCH" | ||
if [ "$BRANCH_NAME" == "$DEFAULT_BRANCH" ]; then | ||
echo "This is the default branch." | ||
echo "IS_DEFAULT_BRANCH=true" >> $GITHUB_ENV | ||
else | ||
echo "This is NOT the default branch." | ||
echo "IS_DEFAULT_BRANCH=false" >> $GITHUB_ENV | ||
fi | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
@@ -81,7 +95,7 @@ jobs: | |
|
||
- name: Deploy candidate | ||
uses: JamesIves/[email protected] | ||
if: ${{ steps.branch-name.outputs.is_default }} == 'false' | ||
if: env.IS_DEFAULT_BRANCH == 'false' | ||
with: | ||
branch: gh-pages # The branch the action should deploy to. | ||
folder: ./output # The folder the action should deploy. | ||
|
@@ -92,7 +106,7 @@ jobs: | |
|
||
- name: Deploy main | ||
uses: JamesIves/[email protected] | ||
if: ${{ steps.branch-name.outputs.is_default }} == 'true' | ||
if: env.IS_DEFAULT_BRANCH == 'true' | ||
with: | ||
branch: gh-pages # The branch the action should deploy to. | ||
folder: ./output # The folder the action should deploy. | ||
|