Skip to content

Commit d99bfc4

Browse files
authored
Add Staging Environment (#131)
1 parent 0f7f409 commit d99bfc4

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

.github/workflows/gh-pages.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,27 @@ jobs:
3131
npm ci --ignore-scripts
3232
env:
3333
NODE_AUTH_TOKEN: ${{ secrets.FONTAWESOME_AUTH_TOKEN }}
34-
- name: Build
35-
run: hugo --minify
36-
- name: Upload artifact
34+
- name: Build production
35+
run: hugo --minify --destination public/prod
36+
- name: Build staging
37+
run: hugo --baseURL=https://staging.cryptomator.org/ --environment=staging --minify --destination public/staging
38+
- name: Add robots.txt for staging
39+
run: 'echo -e "User-agent: *\nDisallow: /" > public/staging/robots.txt'
40+
- name: Upload Prod Pages artifact
3741
uses: actions/upload-pages-artifact@v3
3842
with:
39-
path: 'public'
43+
name: prod-site
44+
path: ./public/prod
45+
- name: Upload Staging artifacts
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: staging-site
49+
path: ./public/staging
4050

41-
# DEPLOY
42-
deploy:
51+
# DEPLOY PROD
52+
deploy-prod:
4353
if: github.ref == 'refs/heads/main'
44-
name: Deploy to GitHub Pages
54+
name: Deploy Prod to GitHub Pages
4555
runs-on: ubuntu-latest
4656
needs: [build]
4757
permissions: # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
@@ -51,6 +61,30 @@ jobs:
5161
- name: Deploy to GitHub Pages
5262
id: deployment
5363
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
64+
with:
65+
artifact_name: prod-site
5466
environment: # Deploy to the github-pages environment
5567
name: github-pages
5668
url: ${{ steps.deployment.outputs.page_url }}
69+
70+
# DEPLOY STAGING
71+
deploy-staging:
72+
if: github.ref == 'refs/heads/develop'
73+
name: Deploy Staging to GitHub Pages
74+
runs-on: ubuntu-latest
75+
needs: [build]
76+
steps:
77+
- name: Download build
78+
uses: actions/download-artifact@v4
79+
with:
80+
name: staging-site
81+
path: ./public
82+
- name: Deploy to Staging Repository
83+
uses: peaceiris/actions-gh-pages@v3
84+
with:
85+
personal_token: ${{ secrets.CRYPTOBOT_DEPLOY_STAGING_WEBSITE }}
86+
external_repository: cryptomator/staging.cryptomator.org
87+
publish_dir: ./public
88+
publish_branch: main
89+
cname: staging.cryptomator.org
90+

config/staging/params.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API
2-
baseApiUrl: http://localhost
3-
storeApiUrl: http://localhost:8787/api
2+
baseApiUrl: https://api.staging.cryptomator.org
3+
storeApiUrl: https://store.staging.cryptomator.org
44

55
# UMAMI
66
umamiWebsiteId: 57a36f3a-bd97-4d8a-9563-0e8d39ddb20c

layouts/_default/baseof.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
{{ end }}
6060
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{{ .Site.LanguagePrefix }}/feed.xml" />
6161
{{ partial "hreflang.html" . }}
62+
{{ if eq hugo.Environment "staging" }}
63+
<meta name="robots" content="noindex">
64+
{{ end }}
6265
</head>
6366
<body x-data="{ isNavOpen: false, globalData: { githubStargazers: null, mastodonFollowers: null } }" x-init="determineGlobalData('{{ .Site.Language.Lang }}', globalData)" :class="isNavOpen && 'overflow-hidden'" class="bg-dark font-body text-gray-900">
6467
{{ partial "nav.html" . }}

0 commit comments

Comments
 (0)