- I create
PROD
environment in Github.
- I add
Environment secrets
as below.
- I will fetch these keys with
String.fromEnvironment
.
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
const supabaseUrl =
String.fromEnvironment('envkey_SUPABASE_URL', defaultValue: "check1");
const supabaseAnonKey = String.fromEnvironment('envkey_SUPABASE_ANONKEY',
defaultValue: "check2");
return const Scaffold(
body: Row(
children: [
Column(
children: [
Text("check"),
Text(supabaseUrl),
Text(supabaseAnonKey),
],
),
],
),
);
}
}
- I deploy flutter web with
Github Actions
in.github/workflows/workflow.yml
.
I create environment file with SpicyPizza/[email protected]
.
name: gh-pages
on:
push:
branches: [main]
jobs:
PROD:
runs-on: ubuntu-latest
environment: PROD
steps:
- uses: actions/checkout@v2
- name: Create environment file
uses: SpicyPizza/[email protected]
with:
envkey_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
envkey_SUPABASE_ANONKEY: ${{ secrets.SUPABASE_ANONKEY }}
- uses: subosito/flutter-action@v1
- uses: bluefireteam/flutter-gh-pages@v7
with:
baseHref: /injicare-event/
Build is done successfully.
However, deployed site shows default value from String.fromEnvironment, which means i can’t fetch keys from environment.
I’ve also added Repository secrets
either as below..
I’ve struggled with this problem for more 2 months.
I’ve done all as all searched document say, but nothing works..
Please help me..!!!! T_T