Skip to content

Commit

Permalink
Fix pages env vars (#1230)
Browse files Browse the repository at this point in the history
* Fix pages env vars

* bring back vercel json
  • Loading branch information
Geometrically authored Jul 4, 2023
1 parent 4c8c35a commit 6e0f223
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy

on: push

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Cloudflare Pages deployment
uses: WalshyDev/cf-pages-await@v1
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: '9ddae624c98677d68d93df6e524a6061'
project: 'knossos'
githubToken: ${{ secrets.GITHUB_TOKEN }}
commitHash: ${{ steps.push-changes.outputs.commit-hash }}
2 changes: 1 addition & 1 deletion .github/workflows/regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: Re-deploy site
run: |
curl -X POST \
${{ secrets.VERCEL_DEPLOY_URL }}
${{ secrets.CLOUDFLARE_DEPLOY_URL }}
11 changes: 9 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,10 @@ export default defineNuxtConfig({

owner: process.env.VERCEL_GIT_REPO_OWNER || 'modrinth',
slug: process.env.VERCEL_GIT_REPO_SLUG || 'knossos',
branch: process.env.VERCEL_GIT_COMMIT_REF || 'master',
hash: process.env.VERCEL_GIT_COMMIT_SHA || 'unknown',
// @ts-ignore
branch: process.env.VERCEL_GIT_COMMIT_REF || globalThis.CF_PAGES_BRANCH || 'master',
// @ts-ignore
hash: process.env.VERCEL_GIT_COMMIT_SHA || globalThis.CF_PAGES_COMMIT_SHA || 'unknown',
},
},
typescript: {
Expand Down Expand Up @@ -309,6 +311,11 @@ function getDomain() {
if (process.env.NODE_ENV === 'production') {
if (process.env.SITE_URL) {
return process.env.SITE_URL
}
// @ts-ignore
else if (process.env.CF_PAGES_URL || globalThis.CF_PAGES_URL) {
// @ts-ignore
return process.env.CF_PAGES_URL ?? globalThis.CF_PAGES_URL
} else if (process.env.HEROKU_APP_NAME) {
return `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`
} else if (process.env.VERCEL_URL) {
Expand Down

0 comments on commit 6e0f223

Please sign in to comment.