-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (75 loc) · 2.96 KB
/
deploy-frontend-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# Primary ref: https://dev.to/ckgrafico/deploying-nextjs-to-azure-web-app-with-github-actions-1o9c
name: (DEV) Deploy frontend
on:
push:
paths:
- frontend/**
branches:
- main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: Development
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js version
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Restore cache
uses: actions/cache@v3
with:
path: |
frontend/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Install ci dependencies
run: yarn --frozen-lockfile --ignore-scripts
- name: Build with Next.js (NO)
run: |
yarn build
mv ./build/static ./build/standalone/build
cp -r ./public ./build/standalone/
mv ./build ./build-no
env:
NEXT_PUBLIC_VIBES_BACKEND_URL: ${{ vars.NEXT_PUBLIC_VIBES_BACKEND_URL_NO }}
NEXT_PUBLIC_CLIENT_ID: ${{ vars.NEXT_PUBLIC_CLIENT_ID }}
NEXT_PUBLIC_TENANT_ID: ${{ vars.NEXT_PUBLIC_TENANT_ID }}
NEXT_PUBLIC_APP_SCOPE: ${{ vars.NEXT_PUBLIC_APP_SCOPE }}
- name: Build with Next.js (SE)
run: |
yarn build
mv ./build/static ./build/standalone/build
cp -r ./public ./build/standalone
mv ./build ./build-se
env:
NEXT_PUBLIC_VIBES_BACKEND_URL: ${{ vars.NEXT_PUBLIC_VIBES_BACKEND_URL_SE }}
NEXT_PUBLIC_CLIENT_ID: ${{ vars.NEXT_PUBLIC_CLIENT_ID }}
NEXT_PUBLIC_TENANT_ID: ${{ vars.NEXT_PUBLIC_TENANT_ID }}
NEXT_PUBLIC_APP_SCOPE: ${{ vars.NEXT_PUBLIC_APP_SCOPE }}
- name: Deploy to App Service (NO)
id: deploy-to-webapp-no
uses: azure/webapps-deploy@v2
with:
app-name: 'vibes-frontend-norway-dev'
slot-name: 'Production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_FRONTEND_NO }}
package: ./frontend/build-no/standalone
- name: Deploy to App Service (SE)
id: deploy-to-webapp-se
uses: azure/webapps-deploy@v2
with:
app-name: 'vibes-frontend-sweden-dev'
slot-name: 'Production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_FRONTEND_SE }}
package: ./frontend/build-se/standalone