Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: gh-pages does not exist message for doc-deploy-dev #475

Merged
merged 23 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f4e7df3
add check for gh-pages branch
klmcadams Apr 29, 2024
afcd8ee
move git command
klmcadams Apr 29, 2024
3937125
checkout repo, check branch, checkout branch
klmcadams Apr 29, 2024
7b395e9
add details to info message
klmcadams Apr 29, 2024
ebe110b
replace phrase with variable
klmcadams Apr 29, 2024
22a342a
make wording less repetitive
klmcadams Apr 29, 2024
59b782c
create branch if it doesn't exist & checkout
klmcadams Apr 30, 2024
9c612d9
remove files in staging area
klmcadams Apr 30, 2024
bc6799d
remote update & track origin
klmcadams Apr 30, 2024
ecc9b97
put remote update and checkout in else
klmcadams Apr 30, 2024
441ee23
clean up info message & replicate code for doc-deploy-stable
klmcadams Apr 30, 2024
b56bb7a
apply suggestions
klmcadams Apr 30, 2024
8fafed3
add pyansys-ci-bot back
klmcadams Apr 30, 2024
993d04c
only create new branch & use git clean
klmcadams Apr 30, 2024
b19d792
apply sebastien's suggestions
klmcadams May 1, 2024
024bb70
need commit to fix err with refspec
klmcadams May 1, 2024
774a953
fetch origin env.branch
klmcadams May 1, 2024
47f92d7
remove cached files & clean untracked files
klmcadams May 1, 2024
259af33
Merge branch 'main' into maint/check-gh-pages
klmcadams May 6, 2024
8aedf20
Merge branch 'main' into maint/check-gh-pages
klmcadams May 6, 2024
8d737e8
Merge branch 'main' into maint/check-gh-pages
klmcadams May 6, 2024
ae022db
Merge branch 'main' into maint/check-gh-pages
RobPasMue May 7, 2024
150b44d
doc: improve step name
jorgepiloto May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion doc-deploy-dev/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,42 @@ runs:
uses: actions/checkout@v4
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ inputs.branch }}
token: ${{ inputs.token }}

- name: "Ensure that the desired branch exists"
env:
BRANCH: ${{ inputs.branch }}
shell: bash
run: |
# Check the ${{ env.BRANCH }} branch exists on remote
branch_exists=$(git ls-remote --heads origin refs/heads/${{ env.BRANCH }} 2>&1)

# If the ${{ env.BRANCH }} doesn't exist, then print error message and exit 1
if [ -z "$branch_exists" ]; then
echo "The ${{ env.BRANCH }} branch does not exist. Creating ${{ env.BRANCH }}."

# Create orphan branch
git checkout --orphan ${{ env.BRANCH }}

# Unstage files to be committed
git rm --cached -r .

# Remove untracked files
git clean -fd

# Configure git username & email
git config user.name 'pyansys-ci-bot'
git config user.email '[email protected]'

klmcadams marked this conversation as resolved.
Show resolved Hide resolved
# Commit ${{ env.BRANCH }} & push to origin
klmcadams marked this conversation as resolved.
Show resolved Hide resolved
git commit --allow-empty -m "Create ${{ env.BRANCH }} branch"
git push -u origin ${{ env.BRANCH }}
else
# Fetch and switch to ${{ env.BRANCH }}
git fetch origin ${{ env.BRANCH }}:${{ env.BRANCH }}
git switch ${{ env.BRANCH }}
fi

# ------------------------------------------------------------------------

- uses: ansys/actions/_logging@main
Expand Down
35 changes: 34 additions & 1 deletion doc-deploy-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,42 @@ runs:
uses: actions/checkout@v4
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ inputs.branch }}
token: ${{ inputs.token }}

- name: "Ensure that the desired branch exists"
env:
BRANCH: ${{ inputs.branch }}
shell: bash
run: |
# Check the ${{ env.BRANCH }} branch exists on remote
branch_exists=$(git ls-remote --heads origin refs/heads/${{ env.BRANCH }} 2>&1)

# If the ${{ env.BRANCH }} doesn't exist, then print error message and exit 1
if [ -z "$branch_exists" ]; then
echo "The ${{ env.BRANCH }} branch does not exist. Creating ${{ env.BRANCH }}."

# Create orphan branch
git checkout --orphan ${{ env.BRANCH }}

# Unstage files to be committed
git rm --cached -r .

# Remove untracked files
git clean -fd

# Configure git username & email
git config user.name 'pyansys-ci-bot'
git config user.email '[email protected]'
klmcadams marked this conversation as resolved.
Show resolved Hide resolved

# Commit ${{ env.BRANCH }} & push to origin
git commit --allow-empty -m "Create ${{ env.BRANCH }} branch"
git push -u origin ${{ env.BRANCH }}
else
# Fetch and switch to ${{ env.BRANCH }}
git fetch origin ${{ env.BRANCH }}:${{ env.BRANCH }}
git switch ${{ env.BRANCH }}
fi

# ------------------------------------------------------------------------

- uses: ansys/actions/_logging@main
Expand Down
Loading