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
This action creates [AWS CodeDeploy](https://aws.amazon.com/codedeploy/) deployments from your GitHub Actions workflow.
3
+
This action creates [AWS CodeDeploy](https://aws.amazon.com/codedeploy/) deployments from your GitHub Actions workflow. Deployment Group and Deployment configuration itself are derived from an additional configuration section in `.appspec.yml`.
4
4
5
-
This document assumes you are familiar with the [basic AWS CodeDeploy concepts](https://docs.aws.amazon.com/codedeploy/latest/userguide/primary
6
-
-components.html).
5
+
_Note:_ This README assumes you are familiar with the [basic AWS CodeDeploy concepts](https://docs.aws.amazon.com/codedeploy/latest/userguide/primary-components.html).
7
6
8
7
## Design Goals
9
8
10
9
While this Action tries to mostly get out of our way, it makes a few basic assumptions:
11
10
12
11
* For your GitHub repository, there is a corresponding CodeDeploy Application already set up.
13
12
* Git branches (and so, GitHub Pull Requests) will be mapped to CodeDeploy Deployment Groups. The action will create these, or update existing ones.
14
-
* Ultimately, a CodeDeploy Deployment is created with a [reference to the current commit in your GitHub repository]
* Ultimately, a CodeDeploy Deployment is created with a [reference to the current commit in your GitHub repository](https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-partners-github.html).
16
14
17
-
The necessary configuration will be parsed from an additional `branch_config` key inside the `appspec.yml` file – which is the core config file for
18
-
AWS CodeDeploy that you will need to keep in your repository anyway.
15
+
The necessary configuration will be parsed from an additional `branch_config` key inside the `appspec.yml` file – which is the core config file for AWS CodeDeploy that you will need to keep in your repository anyway.
19
16
20
-
This makes it possible to create a matching configuration once, and then run deployments in different environments automatically. For example,
21
-
updating a production system for commits or merges on `master`, and independent staging environments for every open Pull Request branch.
17
+
This makes it possible to create a matching configuration once, and then run deployments in different environments automatically. For example, updating a production system for commits or merges on `master`, and independent staging environments for every open Pull Request branch.
22
18
23
19
## Example Use Case
24
20
@@ -52,19 +48,16 @@ jobs:
52
48
@${{ github.actor }} this was deployed as [${{ steps.deploy.outputs.deploymentId }}](https://console.aws.amazon.com/codesuite/codedeploy/deployments/${{ steps.deploy.outputs.deploymentId }}?region=eu-central-1) to group `${{ steps.deploy.outputs.deploymentGroupName }}`.
53
49
```
54
50
55
-
First, this configures AWS Credentials in the GitHub Action runner. The [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) action is used for that, and credentials are kept in [GitHub Actions Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows
56
-
/creating-and-storing-encrypted-secrets).
51
+
First, this configures AWS Credentials in the GitHub Action runner. The [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) action is used for that, and credentials are kept in [GitHub Actions Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets).
57
52
58
-
Second, the repo is checked out because we at least need to access the `appspec.yml` file.
53
+
Second, the current repository is checked out because we at least need to access the `appspec.yml` file.
59
54
60
55
Third, this action is run. It does not need any additional configuration in the workflow file, but we'll look at the `appspec.yml` file in a second.
61
56
62
-
Last, another action is used to show how output generated by this action can be used. In this example, it will leave a GitHub comment on the current
63
-
commit, @notifying the commit author that a deployment was made, and point to the AWS Management Console where details for the deployment can be found.
57
+
Last, another action is used to show how output generated by this action can be used. In this example, it will leave a GitHub comment on the current commit, @notifying the commit author that a deployment was made, and point to the AWS Management Console where details for the deployment can be found.
64
58
65
59
Due to the first few lines in this example, the action will be run for commits pushed to the `master` branch and for Pull Requests
66
-
being opened or pushed to. With that in mind, let's look at the [`appspec.yml` configuration file](https://docs.aws.amazon.com/codedeploy/latest
67
-
/userguide/reference-appspec-file.html).
60
+
being opened or pushed to. With that in mind, let's look at the [`appspec.yml` configuration file](https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file.html).
68
61
69
62
```yaml
70
63
# .appspec.yml
@@ -101,15 +94,9 @@ branch name the action is run on.
101
94
102
95
The subkeys are evaluated as regular expressions in the order listed, and the first matching one is used.
103
96
104
-
The first entry makes the action skip the deployment (do nothing at all) when the current branch is called something like `wip/add-feature-x`. You
105
-
can use this for example if you have a convention for things that are not ready for deployment yet, or if branches are created automatically by other
106
-
tooling and you don't want to deploy them automatically.
97
+
The first entry makes the action skip the deployment (do nothing at all) when the current branch is called something like `wip/add-feature-x`. You can use this, for example, if you have a convention for branches that are not ready for deployment yet, or if branches are created automatically by other tooling and you don't want to deploy them automatically.
107
98
108
-
Commits on the `master` branch are to be deployed in a Deployment Group called `production`. All other commits will create or update a Deployment
109
-
Group named `$BRANCH.staging.acme.tld`, where `$BRANCH` will be replaced with a DNS-safe name derived from the current branch. Basically, a branch
110
-
called `feat/123/new_gimmick` will use `feat-123-new-gimmick` for `$BRANCH`. Since the Deployment Group Name is available in the
111
-
`$DEPLOYMENT_GROUP_NAME`environment variable inside your CodeDeploy Lifecycle Scripts, you can use that to create "staging" environments with a
112
-
single, generic configuration statement.
99
+
Commits on the `master` branch are to be deployed in a Deployment Group called `production`. All other commits will create or update a Deployment Group named `$BRANCH.staging.acme.tld`, where `$BRANCH` will be replaced with a DNS-safe name derived from the current branch. Basically, a branch called `feat/123/new_gimmick` will use `feat-123-new-gimmick` for `$BRANCH`. Since the Deployment Group Name is available in the `$DEPLOYMENT_GROUP_NAME` environment variable inside your CodeDeploy Lifecycle Scripts, you can use that to create "staging" environments with a single, generic configuration statement.
113
100
114
101
The `deploymentGroupConfig` and `deploymentConfig` keys in each of the two cases contain configuration that is passed as-is to the
115
102
[`CreateDeploymentGroup`](https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_CreateDeploymentGroup.html) or
@@ -118,8 +105,7 @@ The `deploymentGroupConfig` and `deploymentConfig` keys in each of the two cases
118
105
`deploymentConfig`. That way, you should be able to configure about every CodeDeploy setting. Note that the `ec2TagFilters` will be used to control
119
106
to which EC2 instances (in the case of instance-based deployments) the deployment will be directed.
120
107
121
-
The only addition made will be that the `revision` parameter for `CreateDeployment` will be set to the current GitHub repository and the commit-ID
122
-
that that action is actually run for.
108
+
The only addition made will be that the `revision` parameter for `CreateDeployment` will be set to point to the current commit (the one the action is running for) in the current repository.
0 commit comments