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

Migrate docs with initial WSL/ROS2 modifications. #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
138 changes: 138 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
name: Deploy documentation to pages branch

# yamllint disable-line rule:truthy
on:
pull_request:
types: [opened, synchronize, reopened, closed]

concurrency:
group: pages-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
deploy:
runs-on: self-hosted
steps:
- name: Wait to let checks appear
run: sleep 1m
shell: bash

# Wait for the CI to finish so we can download the docs artifact
- name: Wait for CI
uses: lewagon/[email protected]
if: github.event.action != 'closed'
with:
ref: ${{ github.event.pull_request.head.ref }}
check-regexp: Run tests and build docs
repo-token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
allowed-conclusions: success
verbose: true

- name: Checkout
uses: actions/checkout@v2

- name: Prepare directories
if: github.event.action != 'closed'
run: |
mkdir -p ${{ github.workspace }}/pr-docs/

- name: Download artifact
uses: dawidd6/action-download-artifact@v6
if: github.event.action != 'closed'
with:
github_token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
workflow: .github/workflows/ci.yaml
workflow_conclusion: completed
commit: ${{ github.event.pull_request.head.sha }}
path: ${{ github.workspace }}/pr-docs

- name: Move folders
if: github.event.action != 'closed'
run: |
cd ${{ github.workspace }}/pr-docs
mv docs-ci-html-${{ github.event.pull_request.head.sha }} ${{ github.event.number }}
echo "datetime=$(TZ=America/New_York date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV

############################
# If commit was an update/refresh (not close)
############################
# Publish the artifact to the GitHub Pages branch
- name: Upload docs to mil.ufl.edu
if: github.event.action != 'closed'
run: |
# Install sshpass
sudo apt-get install sshpass
# Upload contents of local folder to remote folder
sshpass -p ${{ secrets.MIL_UFL_SFTP_PASS }} \
sftp -o StrictHostKeyChecking=no \
-P ${{ secrets.MIL_UFL_SFTP_PORT }} [email protected] << EOF
mkdir htdocs/pr-docs/${{ github.event.number }}
cd htdocs/pr-docs/${{ github.event.number }}
lcd ${{ github.workspace }}/pr-docs/${{ github.event.number }}
put -r .
exit
EOF

# Create/update stickied comment
- name: Update stickied comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event.action != 'closed'
with:
GITHUB_TOKEN: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
header: pr-preview
number: ${{ github.event.number }}
message: >
Hello, it's your friendly InvestiGator bot here!


The **docs preview** for this PR is available at
https://mil.ufl.edu/pr-docs/${{ github.event.number }}.


```css

Last updated at:

► ${{ github.event.pull_request.head.sha }}

► ${{ env.datetime }}

```


Have a great day! Go gators! 🐊

############################
# If commit was closed
############################
# If the PR is closed, remove the files
- name: Delete pr-docs folder on mil.ufl.edu
if: github.event.action == 'closed'
run: |
# Install lftp
sudo apt-get install lftp
# Upload docs
lftp -u mil,${{ secrets.MIL_UFL_SFTP_PASS }} \
-p ${{ secrets.MIL_UFL_SFTP_PORT }} sftp://mil.ufl.edu << EOF
rm -r htdocs/pr-docs/${{ github.event.number }}
exit
EOF

# Create/update stickied comment
- name: Update stickied comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event.action == 'closed'
with:
GITHUB_TOKEN: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
header: pr-preview
number: ${{ github.event.number }}
message: >
Hola, your friendly InvestiGator bot here with another message!


Because this PR was closed/merged, I'm going to remove the docs
preview for now.


Have a great day! Go gators! 🐊
Loading
Loading