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
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
# Deployment Automation with GitHub Actions and Nitric
5
5
6
-
This guide will demonstrate how Nitric can be used, along with [GitHub Actions](https://github.com/features/actions), to create a continuous deployment pipeline. The actions in the example below target AWS, but can be modified to target Google Cloud or Microsoft Azure.
6
+
This guide will demonstrate how Nitric can be used, along with [GitHub Actions](https://github.com/features/actions), to create a continuous deployment pipeline. We provide examples for deploying to AWS, Google Cloud, and Microsoft Azure, which you can adapt based on your preferred cloud provider.
7
7
8
8
<Note>
9
9
This guide assumes basic knowledge about GitHub Actions. If you're new to the
10
10
feature you could start by reviewing [GitHub's
11
11
docs](https://github.com/features/actions)
12
12
</Note>
13
13
14
-
## Workflow setup
14
+
## Configuration
15
15
16
-
To begin you'll need a Nitric project ready to be deployed. If you haven't created a project yet, take a look at the [quickstart guide](/getting-started/quickstart).
16
+
1.**Prepare Your Nitric Project**<br />
17
+
Ensure you have a Nitric project ready to deploy. If you haven’t set up a project yet, refer to our [quickstart guide](/getting-started/quickstart).
17
18
18
-
Next, we'll add a GitHub Actions workflow file to the project. This is where you'll configure the deployment automation steps. Create a yaml file in a `.github/` folder at the root of your project. The file can be named how you like, in our case we'll name it `deploy-aws.yaml`.
19
+
2.**Add a GitHub Actions Workflow File**<br />
20
+
Create a YAML file in a `.github/` folder at the root of your project to configure the deployment automation steps. You can name the file according to your preference; for our examples, we use `deploy-aws.yaml`, `deploy-azure.yaml`, and `deploy-gcp.yaml`.
19
21
20
-
Here is example content you can copy into your workflow file. In the next sections we'll breakdown what's happening in this file, so you can modify it as you see fit.
# You can get a Pulumi access token by logging into Pulumi on the browser and going to your profile settings. Under the 'Access Tokens' tab, click 'Create token.'
# You can get a Pulumi access token by logging into Pulumi on the browser and going to your profile settings. Under the 'Access Tokens' tab, click 'Create token.'
# Triggers the workflow on push to the main branch
72
169
push:
73
170
branches:
74
171
- main
75
-
```
76
-
77
-
### Intialize your workflow
78
-
79
-
Assign a name to the first job in the workflow and set which operating system the workflow will be run on.
80
172
81
-
<Note>We suggest using `ubuntu-latest` as the runs-on value.</Note>
82
-
83
-
```yaml
84
173
jobs:
85
174
update:
86
-
name: Update Deployment
175
+
# The workflow will run on the latest Ubuntu OS
87
176
runs-on: ubuntu-latest
88
-
```
89
177
90
-
### Install Dependencies
178
+
steps:
179
+
# Check out the code from the repository
180
+
- name: Checkout 🛎️
181
+
uses: actions/checkout@v4
91
182
92
-
This step installs Pulumi, allowing you to configure Pulumi settings such as `cloud-url`. You can read more about the Pulumi action configuration at https://github.com/pulumi/actions.
183
+
# Install Pulumi for infrastructure management
184
+
# Learn more about the Pulumi action configuration at https://github.com/pulumi/actions.
185
+
- name: Install and configure Pulumi 📦
186
+
uses: pulumi/actions@v4
93
187
94
-
```yaml
95
-
- name: Install and configure Pulumi 📦
96
-
uses: pulumi/actions@v4
97
-
```
188
+
# Authenticate with Google Cloud to allow deployment
189
+
- name: Authenticate with Google 🔑
190
+
uses: google-github-actions/setup-gcloud@v0
191
+
with:
192
+
# Google Cloud service account key from GitHub secrets
193
+
service_account_key: ${{ secrets.GCP_KEY }}
98
194
99
-
### Deploy the stack
100
-
101
-
Finally, checkout your project and run the `up` command to deploy your project. In this example our project has a stack named `dev`. This job uses the official Nitric GitHub action. To learn more, check out the repository at https://github.com/nitrictech/actions.
# Google Cloud project ID from environment variables
196
+
project_id: ${{ env.PROJECT_ID }}
115
197
116
-
### Environment variables
117
-
118
-
Configure the environment variables required by Nitric's dependency Pulumi and AWS. In this example we store the required values in GitHub secrets. Secrets can be found by navigating to `https://github.com/{user}/{project}/settings/secrets/actions`.
119
-
120
-
- PULUMI_ACCESS_TOKEN
121
-
- You can get a pulumi access token by logging into Pulumi on the browser and going to your profile settings. Under the 'Access Tokens' tab click 'Create token'.
122
-
- PULUMI_CONFIG_PASSPHRASE
123
-
- For interaction free experiences, Pulumi also requires a passphrase to be configured. Your passphrase is used to generate a unique key which encrypts configuration and state values.
124
-
- AWS_ACCESS_KEY_ID
125
-
- You can obtain an ID key from the [AWS console](https://console.aws.amazon.com/).
126
-
- AWS_SECRET_ACCESS_KEY
127
-
- You can obtain an access key from the [AWS console](https://console.aws.amazon.com/).
Below are some example workflows available in the [actions repo](https://github.com/nitrictech/actions):
220
+
# Pulumi access token
221
+
# You can get a Pulumi access token by logging into Pulumi on the browser and going to your profile settings. Under the 'Access Tokens' tab, click 'Create token.'
0 commit comments