Skip to content

Commit

Permalink
Use Tailscale for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Aug 28, 2023
1 parent b41f802 commit f48528e
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'docs/**'

jobs:
docs:
docs_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,27 +17,39 @@ jobs:
mdbook-version: 'latest'
- name: mdbook
run: mdbook build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: book
path: book
docs_deploy:
needs: docs_build
runs-on: ubuntu-latest
if: ${{github.event_name=='push' && github.ref=='refs/heads/main'}}

This comment has been minimized.

Copy link
@Pat-Lafon

Pat-Lafon Aug 29, 2023

Contributor

Previously this also included github.repository_owner == 'sampsyo' to avoid workflows run in forks from attempting(and failing) to deploy. Was this causing an issue?

See #226 for reference

This comment has been minimized.

Copy link
@sampsyo

sampsyo Aug 29, 2023

Author Owner

Good catch; thanks! Totally forgot about this—restored in 8c9fe41.

steps:
- name: Setup Tailscale
uses: tailscale/github-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: book
path: book
- run: ls -R
- name: rsync
if: ${{github.event_name=='push' && github.ref=='refs/heads/main' && github.repository_owner == 'sampsyo'}}
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: courses.cit.cornell.edu
DEPLOY_USER: als485
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
DEPLOY_SRC: ./book/
DEPLOY_DEST: sync/bril-book
DEPLOY_2_HOST: courses
DEPLOY_2_DEST: coursewww/capra.cs.cornell.edu/htdocs/bril
DEPLOY_DEST: coursewww/capra.cs.cornell.edu/htdocs/bril
run: |
echo "$DEPLOY_KEY" > pk
echo "$DEPLOY_KNOWN_HOSTS" > kh
chmod 600 pk
rsync --compress --recursive --checksum --itemize-changes --delete \
-e "ssh -p \"$DEPLOY_PORT\" -i pk -o 'UserKnownHostsFile kh'" \
--perms --chmod=Du=rwx,Dgo=rx,Fu=rw,Fog=r \
-e "ssh -i pk -o 'UserKnownHostsFile kh'" \
$DEPLOY_SRC $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_DEST
ssh -p $DEPLOY_PORT -i pk -o 'UserKnownHostsFile kh' \
$DEPLOY_USER@$DEPLOY_HOST \
rsync --compress --recursive --checksum --itemize-changes \
--delete -e ssh --perms --chmod=Du=rwx,Dgo=rx,Fu=rw,Fog=r \
$DEPLOY_DEST/ $DEPLOY_2_HOST:$DEPLOY_2_DEST

0 comments on commit f48528e

Please sign in to comment.