Skip to content

Commit 8a5fe80

Browse files
Merge pull request #279092 from craigshoemaker/patch-9
[Static Web Apps] Update: Gitlab tutorial (freshness)
2 parents 4f89154 + 13214be commit 8a5fe80

File tree

1 file changed

+53
-23
lines changed

1 file changed

+53
-23
lines changed

articles/static-web-apps/gitlab.md

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: static-web-apps
55
author: craigshoemaker
66
ms.service: static-web-apps
77
ms.topic: quickstart
8-
ms.date: 03/30/2021
8+
ms.date: 06/24/2024
99
ms.author: cshoe
1010
---
1111

@@ -31,7 +31,9 @@ In this tutorial, you learn to:
3131
This article uses a GitHub repository as the source to import code into a GitLab repository.
3232

3333
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+
3435
2. Select **Repo by URL**.
36+
3537
3. In the *Git repository URL* box, enter the repository URL for your choice of framework.
3638

3739
# [No Framework](#tab/vanilla-javascript)
@@ -57,17 +59,23 @@ This article uses a GitHub repository as the source to import code into a GitLab
5759
---
5860

5961
4. In the *Project slug* box, enter **my-first-static-web-app**.
62+
6063
5. Select **Create project** and wait a moment while your repository is set up.
6164

6265
## Create a static web app
6366

6467
Now that the repository is created, you can create a static web app from the Azure portal.
6568

6669
1. Go to the [Azure portal](https://portal.azure.com).
70+
6771
1. Select **Create a Resource**.
72+
6873
1. Search for **Static Web Apps**.
74+
6975
1. Select **Static Web Apps**.
76+
7077
1. Select **Create**.
78+
7179
1. In the _Basics_ section, begin by configuring your new app.
7280

7381
| Setting | Value |
@@ -76,38 +84,54 @@ Now that the repository is created, you can create a static web app from the Azu
7684
| Resource Group | Select the **Create new** link and enter **static-web-apps-gitlab**. |
7785
| Name | Enter **my-first-static-web-app**. |
7886
| Plan type | Select **Free**. |
79-
| Region for Azure Functions API and staging environments | Select the region closest to you. |
8087
| Source | Select **Other**. |
8188

8289
1. Select **Review + create**.
90+
8391
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.
88100

89101
## Create the pipeline task in GitLab
90102

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.
92104

93105
### 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+
95109
1. Go to the repository in GitLab.
110+
96111
1. Select **Settings**.
112+
97113
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**.
103124

104125
### Add file
105126

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+
110133
1. Create a new file named `.gitlab-ci.yml` at the root of the repository. (Make sure the file extension is `.yml`.)
134+
111135
1. Enter the following YAML into the file.
112136

113137
# [No Framework](#tab/vanilla-javascript)
@@ -197,8 +221,9 @@ When following the below steps, make sure that you select * for the environments
197221
| `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 |
198222
| `API_TOKEN` | API token for deployment. | `API_TOKEN: $DEPLOYMENT_TOKEN` | Yes |
199223

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.
202227

203228
Once the deployment is complete, you can view your website.
204229

@@ -211,17 +236,22 @@ Before you can go to your new static site, the deployment build must first finis
211236
The Static Web Apps overview window displays a series of links that help you interact with your web app.
212237

213238
1. Return to your static web app in the Azure portal.
239+
214240
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.
216243

217244
## Clean up resources
218245

219246
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.
220247

221248
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**.
225255

226256
The process to delete the resource group may take a few minutes to complete.
227257

0 commit comments

Comments
 (0)