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 Sep 1, 2022. It is now read-only.
This course is about continuous delivery, or CD, with GitHub Actions. We create two workflows to deploy our app to an AWS S3 bucket automatically. CD is an important part of modern software development, and it has a big meaning. CD is the practice of delivering software faster and with higher quality. To do this, it takes many different practices, behaviors, and technologies.
2
+
3
+
In this course, we focus on workflows to deploy pull requests automatically to a staging environment, and to deploy all merged commits to production. In this course, you will:
Copy file name to clipboardExpand all lines: responses/01_label-trigger.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,38 @@ We will be working with Continuous Delivery. We will...
6
6
- Use AWS configuration
7
7
8
8
Before you start, you should...
9
-
- Introduction to GitHub
10
-
- Continuous Integration with GitHub Actions
9
+
-[Introduction to GitHub](https://lab.github.com/githubtraining/introduction-to-github)
10
+
-[Continuous Integration with GitHub Actions](https://lab.github.com/githubtraining/set-up-continuous-integration-with-github-actions)
11
11
12
12
### What is Continuous Delivery?
13
13
14
-
I'll tell ya!
14
+
According to [continuousdelivery.com](https://continuousdelivery.com/),
15
+
16
+
> Continuous Delivery is the ability to get changes of all types—including new features, configuration changes, bug fixes and experiments—into production, or into the hands of users, safely and quickly in a sustainable way.
17
+
18
+
A lot of things go into delivering "continuously". These things can range from culture and behavior to specific automation. In this course, we're going to focus on deployment automation.
15
19
16
20
## Step 1: Configure a trigger based on labels
17
21
22
+
During the `on` step, we define what should cause this workflow to run. In this case, we want the workflow to run whenever a label is applied to the pull request.
23
+
18
24
### :keyboard: Activity: Configure the workflow trigger based on an a label being added
25
+
26
+
1. Edit this file
27
+
2. Change the name of the directory `CHANGETHIS` to `workflows`, so the title of this file with the path is `.github/workflows/staging-workflow.yml`
28
+
3. Edit the contents of this file to trigger on a label
We will be working with AWS for the deployment environment. AWS will do the work of creating the environment, but first, we need to tell it what we need. That happens in the `environment` section of the workflow file. You have many options here, but for our purpose, we will be using a basic Ubuntu environment for our Node.js application.
3
+
We will be working with AWS for the deployment environment. AWS will do the work of creating the environment, but first, we need to tell it what we need. That happens in the `environment` section of the workflow file.
4
+
5
+
### What are the options?
6
+
7
+
You may want to choose a different environment based on your application. You can read more about [virtual environments for GitHub Actions](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions) on GitHub Help.
4
8
5
9
## Step 2: Choose the environment for AWS
6
10
7
-
### :keyboard: Activity: Choose the Ubuntu environment for our app
11
+
For our `Node.js` application, we will be using a basic Ubuntu environment.
12
+
13
+
### :keyboard: Activity: Choose the Ubuntu environment for our app
Copy file name to clipboardExpand all lines: responses/03_workflow-steps.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,54 @@ So far, the workflow knows what the trigger is and what environment to run in. B
4
4
5
5
## Step 3: Write the steps for the staging workflow
6
6
7
-
### :keyboard: Activity: Write the steps for the staging deployment workflow
7
+
We won't be going into detail on the steps of this workflow, but it would be a good idea to check them out. You'll see that we're adding steps using existing actions for:
8
+
9
+
-`actions/checkout`
10
+
-`Deploy to AWS`
11
+
12
+
### :keyboard: Activity: Write the steps for the staging deployment workflow
It won't be "working" yet, because our next step is to work on the configuration files that AWS will need. But, the logic for this workflow is complete.
6
6
7
7
## Step 4: Merge the staging workflow
8
8
9
-
### :keyboard: Activity: Merge this staging workflow pull request
9
+
### :keyboard: Activity: Merge this staging workflow pull request
### :keyboard: Activity: Create an AWS account by the following specifications, and confirm here.
5
+
### S3 Buckets
6
+
7
+
Amazon S3 Buckets are containers. They're also a very flexible type of data storage- they can be configured to work in many different types of ways. They're popular for their security, scalability, and dependability. Our S3 Bucket will be the container that our application is deployed in, both in staging and in production.
8
+
9
+
## Step 5: Confirm AWS S3 configuration
10
+
11
+
### :keyboard: Activity: Create an AWS account by the following specifications, and confirm here
12
+
13
+
1. Create an account at [aws.amazon.com](https://aws.amazon.com/)
14
+
-_This requires credit card information. If you'd like to continue with the course without an AWS account, Learning Lab will still respond, but none of the deployments will work._
15
+
2.[Create an S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html)
16
+
- If you aren't sure how to get there, you can search for `S3`.
17
+
- The region needs to be the same as what is specified in the `aws-config.yml` file in this pull request. :eyes:**For this exercise, choose us-west-2**. :eyes: If you'd like to choose another region, make sure to update the `aws-config.yml` file to match.
18
+
- For all other options, accept the defaults.
19
+
3. Confirm that you've created an S3 bucket by commenting anything in this pull request
### :keyboard: Activity: Enter your AWS environment variables in this repository
5
+
To automate the authentication, AWS recommends using a process called [IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html). By creating a specific key for a purpose or individual, specific scopes can be specified and access can be tracked.
6
6
7
-
Then confirm you've done that by commenting.
7
+
When you create an access key, the key pair is active by default, and you can use the pair right away. You will be adding the following two secrets to this repository:
8
+
9
+
-**AWS_ACCESS**: This serves as the user identifying token. "Access key ID"
10
+
-**AWS_SECRET**: This represents the secret key value pair that's like a password. It's under "Secret access key".
11
+
12
+
## Step 6: Create and store environment variables
13
+
14
+
### :keyboard: Activity: Create your AWS IAM secrets and enter them in this repository
15
+
16
+
1. Add the tokens to this repository with the token name `AWS_SECRET_KEY`
17
+
2. Once you are done, confirm here by commenting anything in this pull request
18
+
3. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/
19
+
4. In the navigation pane, choose **Users**
20
+
5. Create a new user with **programmatic access**
21
+
6. When setting permissions, search for and select **AmazonS3FullAccess**
22
+
7. Use a tag that will identify this token pair, like **Deployment Learning Lab**
23
+
8.**Download .csv file** to save the access key ID and secret access key to a CSV file on your computer
24
+
- Store the file in a secure location
25
+
- ⚠️ _You will not have access to the secret access key again after this dialog box closes_
26
+
- After you download the CSV file, choose **Close**
27
+
9. Save the _Access key ID_ as a secret, named `AWS_ACCESS_KEY` in the **Settings > Secrets**
28
+
10. Save the _Secret access key_ as a secret, named `AWS_SECRET_KEY` in the **Settings > Secrets**
29
+
11. Once you are done, confirm here by commenting anything in this pull request
0 commit comments