You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-7Lines changed: 27 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,25 +146,45 @@ This is the amazing part of using Azure Static WebApps. Deploying to Azure is co
146
146
1. Fork this repository
147
147
1. Get a [GitHub Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
148
148
1. Run `./azure-deploy.sh`. Please note that if this is the first time you run it, it will create an `.env` file in the root folder. Fill the `.env` file. Run the `./azure-deploy.sh` again.
149
+
1. Once the deployment is done go to the Azure portal, and open the Azure Static Web App resource just created.
150
+
1. Open the "Configuration" pane and add a new environment variable named `DATABASE_URL` and assign the value of the database connection string mentioned before in the local development section.
149
151
1. Done! Well, not really, read next.
150
152
151
153
## Fixing generated workflow file
152
154
153
-
The generated workflow file will not work. Even if the CI/CD pipeline will complete successfully, the Azure Static Web App will not work. This is due to how Onyx, the tool the automate the building and the deployment for Static Web Apps, doesn't now how to properly deal with the nuances of Prisma, that generates the client right away. Fixing this issue is quite easy, just add the following enviroment variable to the workflow, in the "Build and Deploy" step:
155
+
The generated workflow file will not work. Even if the CI/CD pipeline will complete successfully, the Azure Static Web App will not work. This is due to how Onyx, the tool the automate the building and the deployment for Static Web Apps, doesn't now how to properly deal with the nuances of Prisma, that generates the client right away. Fixing this issue is quite easy, just add the following enviroment variable to the workflow.
156
+
157
+
The workflow file you have to change is in `./github/workflow` and in the name has the name retured by the deployment script. For example if the deployment script reported that:
158
+
159
+
```sh
160
+
Static Web App created at: gentle-mud-01cd9ba1e.azurestaticapps.net
161
+
```
162
+
163
+
your workflow file will be `./github/workflow/azure-static-web-apps-gentle-mud-01cd9ba1e.yml`.
164
+
165
+
You can do the requested small change right from your GitHub repository, if you don't want to clone the forked repo locally. Just after the line:
154
166
155
167
```yaml
156
-
env: # Add environment variables here
157
-
NODE_VERSION: 12
158
-
PRE_BUILD_COMMAND: "npm install -g prisma@2.30.3"
159
-
CUSTOM_BUILD_COMMAND: "npm install @prisma/client && npm run build"
160
-
POST_BUILD_COMMAND: "npm install @prisma/client"
168
+
###### End of Repository/Build Configurations ######
161
169
```
162
170
171
+
in the "Build and Deploy" step, add this environment variables:
172
+
173
+
```yaml
174
+
env: # Add environment variables here
175
+
NODE_VERSION: 12
176
+
PRE_BUILD_COMMAND: "npm install -g prisma@2.30.3"
177
+
CUSTOM_BUILD_COMMAND: "npm install @prisma/client && npm run build"
178
+
POST_BUILD_COMMAND: "npm install @prisma/client"
179
+
```
180
+
181
+
Make sure you indent the lines correctly, as requested by YAML syntax, and than commit the change. (If you are using the GitHub online editor, and you don't see any red squiggly lines you should be good to go.)
182
+
163
183
Take a look at the sample workflow in the `./github/workflow` folder to see how your workflow file should look like.
164
184
165
185
## Running on Azure (yep!)
166
186
167
-
After you have commited the changes to the workflow file, the CI/CD pipeline will run again automatically. Once the pipeline has run, you should have a working website. Go to http://[your-swa-name].azurestaticapps.net, and enjoy!
187
+
After you have commited the changes to the workflow file, the CI/CD pipeline will run again automatically (You can verify it from the "Action" section of your GitHub repo). Once the pipeline has run, you should have a working website. Go to http://[your-swa-name].azurestaticapps.net, and enjoy!
0 commit comments