Skip to content

Commit 9bba108

Browse files
feat: updated readme for sst workflow usage
1 parent 163343c commit 9bba108

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

docs/sst.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
11
## [SST Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/sst_workflow.yml)
22

3-
This workflow is used to deploy serverless stack (SST) application on AWS environment. Workflows have been added in `.github/workflows/sst_workflow.yml`.
3+
This workflow is used to deploy or destroy serverless stack (SST) application on AWS environment. Workflows have been added in `.github/workflows/sst_workflow.yml`.
44

55
#### Usage
6-
Below workflow can be used to deploy SST in preview environment when pull request generated and it destroys the preview environment when pull request closed, merged and labeled as destroy, similarly staging and production is deployed using there defined branches.
6+
The following workflow can be used to deploy the SST application in the staging environment when a pull request is generated on the base branch named "master". It will deploy the SST application in the production environment when a new tag is released. Additionally, it will destroy the preview environment when a pull request is closed, merged, and labeled as "destroy".
77

8-
```yaml
9-
name: SST Workflow
10-
11-
on:
12-
pull_request:
13-
types: [closed, merged, labeled]
14-
workflow_dispatch:
15-
jobs:
16-
preview:
17-
uses: clouddrove/github-shared-workflows/.github/workflows/sst_workflow.yml@master
18-
secrets:
19-
AWS_ACCESS_KEY_ID: # AWS Access Key ID for preview
20-
AWS_SECRET_ACCESS_KEY: # AWS Secret Access Key for preview
21-
with:
22-
app-env: # preview
23-
working-directory: # specify your working folder from repo
8+
Inputs:
9+
| Input name | Type | Required | Default | Comment |
10+
|---|---|---|---|---|
11+
| app-env | string | true | | Staging or Production |
12+
| preview | string | false | false | If true SST deployed in preview environment |
13+
| working-directory | string | false | ./ | SST code location path |
14+
| stack-name | string | false | | Specify stack name for deployment |
15+
| yarn-cache | string | false | false | Yarn stores packages in global cache |
16+
| deploy | string | false | true | Plan app stacks or deploy. |
17+
| self-hosted | string | false | true | Deploy stack with github runner or without it. |
2418

25-
staging:
26-
if: ${{ github.base_ref == 'stage' }}
19+
Secrets:
20+
| Secret name | Required | Comment |
21+
|---|---|---|
22+
| token | false | GitHub token for environment deletion |
23+
| env-vars | false | Stack environment variables |
24+
| build-role | true | | AWS authentication role |
25+
26+
```yaml
27+
staging-workflow:
28+
if: ${{ github.event.pull_request.base.ref == 'master' }}
2729
uses: clouddrove/github-shared-workflows/.github/workflows/sst_workflow.yml@master
28-
secrets:
29-
AWS_ACCESS_KEY_ID: # AWS Access Key ID for Stage
30-
AWS_SECRET_ACCESS_KEY: # AWS Secret Access Key for stage
3130
with:
32-
app-env: # stage
33-
working-directory: # specify your working folder from repo
31+
app-env: staging
3432

35-
production:
36-
if: ${{ github.base_ref == 'master' }}
33+
production-workflow:
34+
if: startsWith(github.event.ref, 'refs/tags/v')
3735
uses: clouddrove/github-shared-workflows/.github/workflows/sst_workflow.yml@master
38-
secrets:
39-
AWS_ACCESS_KEY_ID: # AWS Access Key ID for prod
40-
AWS_SECRET_ACCESS_KEY: # AWS Secret Access Key for prod
4136
with:
42-
app-env: # prod
43-
working-directory: # specify your working folder from repo
37+
app-env: production
4438
```
39+
40+
41+
##### Path: `clouddrove/github-shared-workflows/.github/workflows/sst_workflow.yml@master`
42+
43+
Should be used with `on: pull_request`. Includes the following:
44+
1. Adds SST Deployed application link into the description of a pull request.
45+
2. Appends Pull Request number and head branch name for the stage name when the preview environment is set to true.
46+
47+
Handles the following branch naming styles :
48+
- `feature-123`
49+
- `feature_123`
50+
- `feature-123/feature-description`

0 commit comments

Comments
 (0)