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: articles/static-web-apps/gitlab.md
+53-23Lines changed: 53 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ services: static-web-apps
5
5
author: craigshoemaker
6
6
ms.service: static-web-apps
7
7
ms.topic: quickstart
8
-
ms.date: 03/30/2021
8
+
ms.date: 06/24/2024
9
9
ms.author: cshoe
10
10
---
11
11
@@ -31,7 +31,9 @@ In this tutorial, you learn to:
31
31
This article uses a GitHub repository as the source to import code into a GitLab repository.
32
32
33
33
1. Sign in to your GitLab account and go to [https://gitlab.com/projects/new#import_project](https://gitlab.com/projects/new#import_project)
34
+
34
35
2. Select **Repo by URL**.
36
+
35
37
3. In the *Git repository URL* box, enter the repository URL for your choice of framework.
36
38
37
39
# [No Framework](#tab/vanilla-javascript)
@@ -57,17 +59,23 @@ This article uses a GitHub repository as the source to import code into a GitLab
57
59
---
58
60
59
61
4. In the *Project slug* box, enter **my-first-static-web-app**.
62
+
60
63
5. Select **Create project** and wait a moment while your repository is set up.
61
64
62
65
## Create a static web app
63
66
64
67
Now that the repository is created, you can create a static web app from the Azure portal.
65
68
66
69
1. Go to the [Azure portal](https://portal.azure.com).
70
+
67
71
1. Select **Create a Resource**.
72
+
68
73
1. Search for **Static Web Apps**.
74
+
69
75
1. Select **Static Web Apps**.
76
+
70
77
1. Select **Create**.
78
+
71
79
1. In the _Basics_ section, begin by configuring your new app.
72
80
73
81
| Setting | Value |
@@ -76,38 +84,54 @@ Now that the repository is created, you can create a static web app from the Azu
76
84
| Resource Group | Select the **Create new** link and enter **static-web-apps-gitlab**. |
77
85
| Name | Enter **my-first-static-web-app**. |
78
86
| Plan type | Select **Free**. |
79
-
| Region for Azure Functions API and staging environments | Select the region closest to you. |
80
87
| Source | Select **Other**. |
81
88
82
89
1. Select **Review + create**.
90
+
83
91
1. Select **Create**.
84
-
2. Select **Go to resource**.
85
-
3. Select **Manage deployment token**.
86
-
4. Copy the deployment token value and set it aside in an editor for later use.
87
-
5. Select **Close** on the *Manage deployment token* window.
92
+
93
+
1. Select **Go to resource**.
94
+
95
+
1. Select **Manage deployment token**.
96
+
97
+
1. Copy the deployment token value and set it aside in an editor for later use.
98
+
99
+
1. Select **Close** on the *Manage deployment token* window.
88
100
89
101
## Create the pipeline task in GitLab
90
102
91
-
Next you add a workflow task responsible for building and deploying your site as you make changes.
103
+
Now that you have your deployment token, you add a workflow task responsible for building and deploying your site as you make changes.
92
104
93
105
### Add deployment token
94
-
When following the below steps, make sure that you select * for the environments section. It may appear the default value is all but you need to click the dropdown and manually select *.
106
+
107
+
When going through the following steps, make sure that you select `*` for the environments section. It may appear the default value is `all`, but you need to select the dropdown and manually choose `*`.
108
+
95
109
1. Go to the repository in GitLab.
110
+
96
111
1. Select **Settings**.
112
+
97
113
1. Select **CI/CD**.
98
-
2. Next to the *Variables* section, select **Expand**.
99
-
3. Select **Add variable**.
100
-
4. In the *Key* box, enter **DEPLOYMENT_TOKEN**.
101
-
5. In the *Value* box, paste in the deployment token value you set aside in a previous step.
102
-
6. Select **Add variable**.
114
+
115
+
1. Next to the *Variables* section, select **Expand**.
116
+
117
+
1. Select **Add variable**.
118
+
119
+
1. In the *Key* box, enter **DEPLOYMENT_TOKEN**.
120
+
121
+
1. In the *Value* box, paste in the deployment token value you set aside in a previous step.
122
+
123
+
1. Select **Add variable**.
103
124
104
125
### Add file
105
126
106
-
1. Select the **Repository** menu option.
107
-
1. Select **Files**.
108
-
1. Ensure the *main* branch is selected in the branch drop down at the top.
109
-
1. Press the **plus sign** drop down and select **New file**.
127
+
1. Return to your repository's main screen in GitLab.
128
+
129
+
1. Select the **Edit** button and choose, **Web IDE**.
130
+
131
+
1. Ensure the *main* branch is selected in the branch drop down.
132
+
110
133
1. Create a new file named `.gitlab-ci.yml` at the root of the repository. (Make sure the file extension is `.yml`.)
134
+
111
135
1. Enter the following YAML into the file.
112
136
113
137
# [No Framework](#tab/vanilla-javascript)
@@ -197,8 +221,9 @@ When following the below steps, make sure that you select * for the environments
197
221
| `OUTPUT_PATH` | Location of the build output folder relative to the `APP_PATH`. | If your application source code is located at `$CI_PROJECT_DIR/app`, and the build script outputs files to the `$CI_PROJECT_DIR/app/build` folder, then set `$CI_PROJECT_DIR/app/build` as the `OUTPUT_PATH` value. | No |
198
222
| `API_TOKEN` | API token for deployment. | `API_TOKEN: $DEPLOYMENT_TOKEN` | Yes |
199
223
200
-
2. Select **Commit changes**.
201
-
3. Select the **CI/CD** then **Pipelines** menu items to view the progress of your deployment.
224
+
1. **Commit changes** to the main branch and close the web IDE.
225
+
226
+
1. Return to your site and select the **Settings** > **CI/CD** > **General Pipelines** menu items to view the progress of your deployment.
202
227
203
228
Once the deployment is complete, you can view your website.
204
229
@@ -211,17 +236,22 @@ Before you can go to your new static site, the deployment build must first finis
211
236
The Static Web Apps overview window displays a series of links that help you interact with your web app.
212
237
213
238
1. Return to your static web app in the Azure portal.
239
+
214
240
1. Go to the **Overview** window.
215
-
2. Select the link under the *URL* label. Your website loads in a new tab.
241
+
242
+
1. Select the link under the *URL* label. Your website loads in a new tab.
216
243
217
244
## Clean up resources
218
245
219
246
If you're not going to continue to use this application, you can delete the Azure Static Web Apps instance and all the associated services by removing the resource group.
220
247
221
248
1. Select the **static-web-apps-gitlab** resource group from the *Overview* section.
222
-
2. Select **Delete resource group** at the top of the resource group *Overview*.
223
-
3. Enter the resource group name **static-web-apps-gitlab** in the *Are you sure you want to delete "static-web-apps-gitlab"?* confirmation dialog.
224
-
4. Select **Delete**.
249
+
250
+
1. Select **Delete resource group** at the top of the resource group *Overview*.
251
+
252
+
1. Enter the resource group name **static-web-apps-gitlab** in the *Are you sure you want to delete "static-web-apps-gitlab"?* confirmation dialog.
253
+
254
+
1. Select **Delete**.
225
255
226
256
The process to delete the resource group may take a few minutes to complete.
0 commit comments