Skip to content

Commit

Permalink
update and debug
Browse files Browse the repository at this point in the history
  • Loading branch information
costateixeira authored Apr 5, 2024
1 parent afad96a commit 9d3df04
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ghbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 9d3df04

Please sign in to comment.