-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace GitHub Pages with mil.ufl.edu (#1170)
* Setup SFTP to replace GitHub pages for non-master branches * Add replacement docs builder * Update docs template to show last-updated at date * Update CI to use port 266, fix building docs on master * Add recursive star for sftp * trying quotes * Use relative dir * Testing lftp for easier control over moving big directories with sftp * Supplying github workspace into local folder name for lftp command * Trying with sshpass and sftp commands * Fixing sshpass escape slash * Disable StrictHostKeyChecking in sftp * Finish up sftp/lftp docs * Remove uses clause
- Loading branch information
Showing
4 changed files
with
52 additions
and
43 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 |
---|---|---|
|
@@ -124,12 +124,16 @@ jobs: | |
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y rsync | ||
# Publish the artifact to the GitHub Pages branch | ||
- name: Push docs to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }} | ||
branch: main | ||
repository-name: uf-mil/uf-mil.github.io | ||
folder: ${{ github.workspace }}/build/docs | ||
target-folder: docs | ||
commit-message: Updating docs to ${{ github.sha }} | ||
- name: Push docs to mil.ufl.edu | ||
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 | ||
cd htdocs/docs | ||
lcd ${{ github.workspace }}/build/docs | ||
put -r . | ||
exit | ||
EOF |
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ concurrency: | |
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-20.04 | ||
runs-on: self-hosted | ||
steps: | ||
- name: Wait to let checks appear | ||
run: sleep 1m | ||
|
@@ -47,31 +47,32 @@ jobs: | |
commit: ${{ github.event.pull_request.head.sha }} | ||
path: ${{ github.workspace }}/pr-docs | ||
|
||
# We need to install rsync for GitHub Pages deploy action | ||
- name: Install rsync | ||
run: | | ||
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y rsync | ||
- 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: Push preview to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
- name: Upload docs to mil.ufl.edu | ||
if: github.event.action != 'closed' | ||
with: | ||
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }} | ||
branch: main | ||
git-config-name: uf-mil-bot | ||
git-config-email: [email protected] | ||
repository-name: uf-mil/uf-mil.github.io | ||
folder: ${{ github.workspace }}/pr-docs/${{ github.event.number }} | ||
target-folder: pr-docs/${{ github.event.number }} | ||
commit-message: "Adding PR preview for PR ${{ github.event.number }}" | ||
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 | ||
|
@@ -86,7 +87,7 @@ jobs: | |
The **docs preview** for this PR is available at | ||
https://uf-mil.github.io/pr-docs/${{ github.event.number }}. | ||
https://mil.ufl.edu/pr-docs/${{ github.event.number }}. | ||
```css | ||
|
@@ -102,24 +103,21 @@ jobs: | |
Have a great day! Go gators! 🐊 | ||
############################ | ||
# If commit was closed | ||
############################ | ||
# If the PR is closed, remove the files | ||
- name: Prepare empty folder | ||
- name: Delete pr-docs folder on mil.ufl.edu | ||
if: github.event.action == 'closed' | ||
run: | | ||
echo "emptydir=$(mktemp -d)" >> $GITHUB_ENV | ||
- name: Prepare deletion folders | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
if: github.event.action == 'closed' | ||
with: | ||
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }} | ||
branch: main | ||
git-config-name: uf-mil-bot | ||
git-config-email: [email protected] | ||
repository-name: uf-mil/uf-mil.github.io | ||
folder: ${{ env.emptydir }} | ||
target-folder: pr-docs/${{ github.event.number }} | ||
commit-message: Removing PR preview for PR ${{ github.event.number }} | ||
# 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 | ||
|
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
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