Skip to content

Commit d8fba3f

Browse files
fixup: deploy env variables from env file
1 parent 3df35ee commit d8fba3f

File tree

5 files changed

+43
-26
lines changed

5 files changed

+43
-26
lines changed

.github/workflows/app.yaml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
runs-on: ubuntu-latest
1515
environment: Development
1616
env:
17+
APP_HOST: dev.stellerom.no
18+
ROOM_API_URL: https://room-api-dev.stellerom.no
19+
REVIEW_API_URL: https://review-api-dev.stellerom.no
1720
AZURE_ADB2C_CLIENT_ID: ${{ vars.AZURE_ADB2C_CLIENT_ID }}
1821
AZURE_ADB2C_CLIENT_SECRET: ${{ secrets.AZURE_ADB2C_CLIENT_SECRET }}
19-
AZURE_ADB2C_TENANT_ID: ${{ vars.AZURE_ADB2C_TENANT_ID }}
20-
AZURE_ADB2C_DOMAIN: stellerom.ciamlogin.com
21-
AZURE_ADB2C_POLICY: ""
2222

2323
steps:
2424
- name: Clone repository
@@ -29,16 +29,17 @@ jobs:
2929
with:
3030
deno-version: v2.x
3131

32-
- name: Build step
32+
- name: Prepare .env file
33+
run: cat .env.template | envsubst > .env
34+
35+
- name: Build
3336
run: deno task build
3437
working-directory: app
3538

36-
- name: Upload to Deno Deploy
37-
uses: denoland/deployctl@v1
38-
with:
39-
project: "stellerom-dev"
40-
entrypoint: "main.ts"
41-
root: "app"
39+
- name: Deploy
40+
run: |
41+
deployctl deploy --project=stellerom-dev --entrypoint=main.ts --env-file=.env
42+
working-directory: app
4243

4344

4445
deploy_prod:
@@ -47,11 +48,11 @@ jobs:
4748
runs-on: ubuntu-latest
4849
environment: Production
4950
env:
51+
APP_HOST: www.stellerom.no
52+
ROOM_API_URL: https://room-api-prod.stellerom.no
53+
REVIEW_API_URL: https://review-api-prod.stellerom.no
5054
AZURE_ADB2C_CLIENT_ID: ${{ vars.AZURE_ADB2C_CLIENT_ID }}
5155
AZURE_ADB2C_CLIENT_SECRET: ${{ secrets.AZURE_ADB2C_CLIENT_SECRET }}
52-
AZURE_ADB2C_TENANT_ID: ${{ vars.AZURE_ADB2C_TENANT_ID }}
53-
AZURE_ADB2C_DOMAIN: stellerom.ciamlogin.com
54-
AZURE_ADB2C_POLICY: ""
5556

5657
steps:
5758
- name: Clone repository
@@ -62,15 +63,15 @@ jobs:
6263
with:
6364
deno-version: v2.x
6465

65-
- name: Build step
66+
- name: Prepare .env file
67+
run: cat .env.template | envsubst > .env
68+
69+
- name: Build
6670
run: deno task build
6771
working-directory: app
6872

69-
- name: Upload to Deno Deploy
70-
uses: denoland/deployctl@v1
71-
with:
72-
project: "christianfosli-stellerom"
73-
entrypoint: "main.ts"
74-
root: "app"
75-
73+
- name: Deploy
74+
run: |
75+
deployctl deploy --project=christianfosli-stellerom --entrypoint=main.ts --env-file=.env
76+
working-directory: app
7677

app/.env.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
APP_HOST=${APP_HOST}
2+
REVIEW_API_URL=${REVIEW_API_URL}
3+
ROOM_API_URL=${ROOM_API_URL}
4+
AZURE_ADB2C_CLIENT_ID=${AZURE_ADB2C_CLIENT_ID}
5+
AZURE_ADB2C_CLIENT_SECRET=${AZURE_ADB2C_CLIENT_SECRET}
6+
AZURE_ADB2C_TENANT_ID=5569d226-c698-4efc-aa21-21f3c6ebf398
7+
AZURE_ADB2C_DOMAIN=stellerom.ciamlogin.com
8+
AZURE_ADB2C_POLICY=""

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
_fresh/
3+
.env

app/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ and deployed using Deno Deploy.
77

88
Install Deno if needed.
99

10-
Start the project:
10+
Prepare .env file
1111

12+
```sh
13+
cp .env.template .env
14+
# Replace the required values as needed
1215
```
16+
17+
Start the project:
18+
19+
```sh
1320
deno task start
1421
```
1522

app/deno.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
55
"cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
66
"manifest": "deno task cli manifest $(pwd)",
7-
"start": "deno run -A --unstable-kv --watch=static/,routes/ dev.ts",
8-
"build": "deno run -A --unstable-kv dev.ts build",
9-
"preview": "deno run -A --unstable-kv main.ts",
7+
"start": "deno run -A --unstable-kv --env-file=.env --watch=static/,routes/ dev.ts",
8+
"build": "deno run -A --unstable-kv --env-file=.env dev.ts build",
9+
"preview": "deno run -A --unstable-kv --env-file=.env main.ts",
1010
"update": "deno run -A -r https://fresh.deno.dev/update ."
1111
},
1212
"lint": {
@@ -45,4 +45,4 @@
4545
"jsxImportSourceTypes": "@types/preact"
4646
},
4747
"nodeModulesDir": "auto"
48-
}
48+
}

0 commit comments

Comments
 (0)