5
5
workflows : ["Record PR details"]
6
6
types :
7
7
- completed
8
+ concurrency :
9
+ group : on-merge-to-main
8
10
9
11
jobs :
10
12
get_pr_details :
@@ -15,10 +17,30 @@ jobs:
15
17
workflow_origin : ${{ github.event.repository.full_name }}
16
18
secrets :
17
19
token : ${{ secrets.GITHUB_TOKEN }}
20
+ run-unit-tests :
21
+ uses : ./.github/workflows/reusable-run-unit-tests.yml
22
+ publish :
23
+ needs :
24
+ [get_pr_details, run-unit-tests, check-examples, check-layer-publisher]
25
+ uses : ./.github/workflows/reusable-publish-docs.yml
26
+ with :
27
+ workflow_origin : ${{ github.event.repository.full_name }}
28
+ prIsMerged : ${{ needs.get_pr_details.outputs.prIsMerged }}
29
+ secrets :
30
+ token : ${{ secrets.GITHUB_TOKEN }}
31
+ update-release-draft :
32
+ needs : publish
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - name : Checkout code
36
+ uses : actions/checkout@v3
37
+ - name : Update release draft
38
+ uses :
release-drafter/[email protected]
39
+ env :
40
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18
41
release_label_on_merge :
19
- needs : get_pr_details
42
+ needs : [ get_pr_details, update-release-draft]
20
43
runs-on : ubuntu-latest
21
- if : needs.get_pr_details.outputs.prIsMerged == 'true'
22
44
steps :
23
45
- uses : actions/checkout@v3
24
46
- name : " Label PR related issue for release"
33
55
script : |
34
56
const script = require('.github/scripts/label_related_issue.js')
35
57
await script({github, context, core})
36
- publish :
37
- # ########################
38
- # Force Github action to run only a single job at a time (based on the group name)
39
- # This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` (#365)
40
- # ########################
41
- concurrency :
42
- group : on-merge-to-main
43
- runs-on : ubuntu-latest
44
- steps :
45
- - name : " Checkout"
46
- uses : actions/checkout@v3
47
- with :
48
- fetch-depth : 0
49
- # ########################
50
- # Release new version
51
- # ########################
52
- - name : " Use NodeJS 16"
53
- uses : actions/setup-node@v3
54
- with :
55
- node-version : ' 16'
56
-
57
- run : npm i -g npm@next-8
58
- - name : " Setup npm"
59
- run : |
60
- npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
61
- - name : Install monorepo packages
62
- # This installs all the dependencies of ./packages/*
63
- # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
64
- run : npm ci --foreground-scripts
65
- - name : Install CDK example packages
66
- # Since we are not managing the CDK examples with npm workspaces we install
67
- # the dependencies in a separate step
68
- working-directory : ./examples/cdk
69
- run : npm ci
70
- - name : Install Layer publisher app
71
- working-directory : ./layer-publisher
72
- run : npm ci
73
- - name : " Setup SAM"
74
- # We use an ad-hoc action so we can specify the SAM CLI version
75
- uses : aws-actions/setup-sam@v2
76
- with :
77
- version : 1.49.0
78
- - name : Install SAM example packages
79
- # Since we are not managing the SAM examples with npm workspaces we install
80
- # the dependencies in a separate step
81
- working-directory : ./examples/sam
82
- run : npm ci
83
- - name : Run lint
84
- run : npm run lerna-lint
85
- - name : Run tests
86
- run : npm run lerna-test
87
- - name : Update release draft
88
- uses :
release-drafter/[email protected]
89
- env :
90
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
91
- # ########################
92
- # Generate documentation
93
- # ########################
94
- - name : Set up Python
95
- uses : actions/setup-python@v4
96
- with :
97
- python-version : ' 3.8'
98
- - name : Install doc generation dependencies
99
- run : |
100
- pip install --upgrade pip
101
- pip install -r docs/requirements.txt
102
- - name : Setup doc deploy
103
- run : |
104
- git config --global user.name Docs deploy
105
- git config --global user.email [email protected]
106
- - name : Build mkdocs site in "gh-pages" branch and push
107
- run : |
108
- rm -rf site
109
- VERSION="dev"
110
- echo "Publishing doc for version: $VERSION"
111
- mkdocs build
112
- mike deploy --push "$VERSION"
113
- - name : Build API docs
114
- run : |
115
- rm -rf api
116
- npm run docs-generateApiDoc
117
- - name : Release API docs to the released version
118
- uses : peaceiris/actions-gh-pages@v3
119
- with :
120
- github_token : ${{ secrets.GITHUB_TOKEN }}
121
- publish_dir : ./api
122
- keep_files : true
123
- destination_dir : dev/api
124
- - name : Release API docs to the "latest" version
125
- uses : peaceiris/actions-gh-pages@v3
126
- with :
127
- github_token : ${{ secrets.GITHUB_TOKEN }}
128
- publish_dir : ./api
129
- keep_files : true
130
- destination_dir : latest/api
0 commit comments