1- # Deploys a static site
21name : Deploy Site
32
43on :
1211 required : true
1312 default : " main"
1413
15- concurrency :
16- group : ${{ github.workflow }}-${{ github.ref }}
17- cancel-in-progress : true
18-
1914jobs :
2015 deploy :
2116 runs-on : ubuntu-latest
@@ -25,54 +20,15 @@ jobs:
2520 contents : read
2621
2722 steps :
28- - name : Check variables set
29- # Make it easier to see when environment setup is incorrect
30- run : |
31- if [ -z "${{ secrets.SSH_PRIVATE_KEY }}" ]; then
32- echo "SSH_PRIVATE_KEY is not set"
33- exit 1
34- fi
35- if [ -z "${{ vars.DROPLET_IP }}" ]; then
36- echo "DROPLET_IP is not set"
37- exit 1
38- fi
39- if [ -z "${{ vars.SITE_NAME }}" ]; then
40- echo "SITE_NAME is not set"
41- exit 1
42- fi
43-
44- - name : Checkout code
45- uses : actions/checkout@v4
46- with :
47- ref : ${{ github.event.inputs.branch || github.ref }}
48-
49- - name : Setup static site builder (e.g. Quarto)
50- uses : quarto-dev/quarto-actions/setup@v2
51-
52- # NOTE: you may need to install python or R dependencies here (that will depend on how the project is setup)
23+ # NOTE: if the action fails to set up python or R environments correctly, you should be able to do that here before calling the action.
5324 # E.g., Make sure QUARTO_PYTHON points to a python with jupyter, pandas, plotly, etc. installed.
5425
55- - name : Build static site files
56- uses : quarto-dev/quarto-actions/render@v2
57-
58- - name : Send static files to server
59- 60- with :
61- host : ${{ vars.DROPLET_IP }}
62- username : webadmin
63- key : ${{ secrets.SSH_PRIVATE_KEY }}
64- port : 22
65- source : ./_site/ # This is the default build directory for Quarto
66- target : sites/${{ vars.SITE_NAME }}/static/
67- strip_components : 2
68- overwrite : true
69-
70- - name : Update frontend files on server
71- 26+ - name : Deploy site via template action
27+ uses : TimChild/webserver-template/actions/deploy-quarto-static-site@main
7228 with :
73- host : ${{ vars.DROPLET_IP }}
74- username : webadmin
75- key : ${{ secrets.SSH_PRIVATE_KEY }}
76- # Note: This script is present on the server from the webserver setup
77- script : |
78- ./scripts/webserver-update-static-files.sh
29+ vps-ip : ${{ vars.VPS_IP }}
30+ site-name : ${{ vars.SITE_NAME }}
31+ uses-python : true
32+ uses-r : false
33+ ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
34+ ssh-user : " webadmin "
0 commit comments