@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
22
33on :
44 push :
5- branches : ["main"]
5+ branches : ["main", "develop" ]
66 workflow_dispatch :
77
88jobs :
@@ -22,25 +22,61 @@ jobs:
2222 cache : ' npm'
2323 - name : Install dependencies
2424 run : npm ci
25- - name : Build with Docusaurus
25+ - name : Build production
2626 run : npm run build
27- - name : Upload artifact
27+ - name : Upload Prod Pages artifact
2828 uses : actions/upload-pages-artifact@v3
2929 with :
30+ name : prod-site
31+ path : ' ./build'
32+ - name : Build staging
33+ run : npm run build
34+ env :
35+ SITE_URL : https://docs.staging.cryptomator.org
36+ - name : Add robots.txt for staging
37+ run : ' echo -e "User-agent: *\nDisallow: /" > build/robots.txt'
38+ - name : Upload Staging artifact
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : staging-site
3042 path : ' ./build'
3143
32- # DEPLOY
33- deploy :
34- name : Deploy to GitHub Pages
44+ # DEPLOY PROD
45+ deploy-prod :
46+ if : github.ref == 'refs/heads/main'
47+ name : Deploy Prod to GitHub Pages
3548 runs-on : ubuntu-latest
3649 needs : [build]
37- permissions : # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
38- pages : write # to deploy to Pages
39- id-token : write # to verify the deployment originates from an appropriate source
50+ permissions :
51+ pages : write
52+ id-token : write
4053 steps :
4154 - name : Deploy to GitHub Pages
4255 id : deployment
43- uses : actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
44- environment : # Deploy to the github-pages environment
56+ uses : actions/deploy-pages@v4
57+ with :
58+ artifact_name : prod-site
59+ environment :
4560 name : github-pages
4661 url : ${{ steps.deployment.outputs.page_url }}
62+
63+ # DEPLOY STAGING
64+ deploy-staging :
65+ if : github.ref == 'refs/heads/develop'
66+ name : Deploy Staging to GitHub Pages
67+ runs-on : ubuntu-latest
68+ needs : [build]
69+ steps :
70+ - name : Download build
71+ uses : actions/download-artifact@v4
72+ with :
73+ name : staging-site
74+ path : ./public
75+ - name : Deploy to Staging Repository
76+ uses : peaceiris/actions-gh-pages@v3
77+ with :
78+ personal_token : ${{ secrets.CRYPTOBOT_DEPLOY_STAGING_DOCS }}
79+ external_repository : cryptomator/docs-staging
80+ publish_dir : ./public
81+ publish_branch : main
82+ cname : docs.staging.cryptomator.org
0 commit comments