Open ieiekk opened 10 months ago
@ieiekk Do you happen to use a setup with a fresh.config.ts
or without one? Asking because before we introduced fresh.config.ts
the dev.ts
would always load main.ts
which in turn imports every file of the application. In doing so it will encounter the supabase
call and complain that the environment variables are not set. That's the main reason we introduced the fresh.config.ts
which allows us to properly split the development mode internally so that you can create a build without loading main.ts
This works! I add SUPABASE_URL and SUPABASE_KEY as secrets:
And add these lines in my deploy.yml:
name: Deploy
on:
push:
branches: [master, develope]
pull_request:
branches: master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Build step
+ env:
+ SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
+ SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
run: "deno task build"
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "pp-greeting-cards-platform"
entrypoint: "./main.ts"
Hope this helps anyone encountered the same issue.
@ieiekk Do you happen to use a setup with a
fresh.config.ts
or without one? Asking because before we introducedfresh.config.ts
thedev.ts
would always loadmain.ts
which in turn imports every file of the application. In doing so it will encounter thesupabase
call and complain that the environment variables are not set. That's the main reason we introduced thefresh.config.ts
which allows us to properly split the development mode internally so that you can create a build without loadingmain.ts
I leave that file as default:
import { defineConfig } from "$fresh/server.ts";
import twindPlugin from "$fresh/plugins/twind.ts";
import twindConfig from "./twind.config.ts";
export default defineConfig({
plugins: [twindPlugin(twindConfig)],
});
So is there a way to avoid import some files during build time? Thanks in advance 🙏
Same here, no way to make the build step in github actions without env variables. That is somehow unexpected as they are server side variables @marvinhagemeister
I think there needs to be a way to know which variables will be needed. The only way I could verify which variables are needed for the build to not crash was by renaming my local .env and trying a local build. It appears the secrets are overwritten once the server is running and the environment variables are loaded in anyway.
This is what I wrote in utils.ts:
After I push the commit, I got this error message on GIthub workflow page:
And I've setup the env var on deno deploy dashboard and this works on local .env file.