5757 run : |
5858 yarn lint
5959
60+ # Verify compiled schema is up to date
61+ # If this action fails, it means one have to run `yarn build:schema` and commit changes in the file
62+ verify-compiled-schema-up-to-date :
63+ name : Verify openapi.json file is up to date
64+ # We run this on the latest ubuntu
65+ runs-on : ubuntu-latest
66+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.event_name == 'pull_request'
67+ timeout-minutes : 10
68+
69+ # We use node 14.X
70+ strategy :
71+ matrix :
72+ node-version : [14.x]
73+
74+ # The following steps are performed for each job
75+ steps :
76+ - name : Check out the repo
77+ uses : actions/checkout@v3
78+
79+ - name : Set up Node.js ${{ matrix.node-version }}
80+ uses : actions/setup-node@v3
81+ with :
82+ node-version : ${{ matrix.node-version }}
83+
84+ - name : Compile the content
85+ run : |
86+ yarn install
87+ yarn build:schema
88+
89+ - name : Verify openapi.json file is up to date (run 'yarn build:schema' and commit changes in openapi.json file if this command returns error)
90+ run : git diff --quiet openapi.json
91+
6092 # The deploy task actually deploys any changes to the en branch
6193 push-to-en :
6294 # We run this on the latest ubuntu
73105 needs :
74106 - lint
75107
76- # The following steps are performed for each lint job
108+ # The following steps are performed for each job
77109 steps :
78110 - name : Check out the repo
79111 uses : actions/checkout@v3
@@ -86,23 +118,23 @@ jobs:
86118 - name : Compile the content
87119 run : |
88120 yarn install
89- yarn build
121+ yarn build:content
90122 yarn build:swagger
91123
92124 - name : Push compiled content
93125 uses : s0/git-publish-subdir-action@v2.4.0
94126 env :
95127 REPO : self
96128 BRANCH : en
97- FOLDER : compiled/openapi
129+ FOLDER : compiled/content
98130 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99131
100132 - name : Push GH pages for redundancy
101133 uses : s0/git-publish-subdir-action@v2.4.0
102134 env :
103135 REPO : self
104136 BRANCH : gh-pages
105- FOLDER : compiled/openapi
137+ FOLDER : compiled/content
106138 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
107139
108140 - name : Push Swagger 2.0 backport
@@ -168,7 +200,7 @@ jobs:
168200 needs :
169201 - lint
170202
171- # The following steps are performed for each lint job
203+ # The following steps are performed for each job
172204 steps :
173205 - name : Check out the repo
174206 uses : actions/checkout@v3
@@ -181,14 +213,14 @@ jobs:
181213 - name : Compile the content
182214 run : |
183215 yarn install
184- yarn build
216+ yarn build:content
185217
186218 - name : Push compiled content
187219 uses : s0/git-publish-subdir-action@v2.4.0
188220 env :
189221 REPO : self
190222 BRANCH : en-staging
191- FOLDER : compiled/openapi
223+ FOLDER : compiled/content
192224 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
193225
194226 - name : " Trigger Netlify deployment"
@@ -222,7 +254,7 @@ jobs:
222254 # We run this on the latest ubuntu
223255 runs-on : ubuntu-latest
224256
225- # The following steps are performed for each lint job
257+ # The following steps are performed for each job
226258 steps :
227259 - name : Check out the repo
228260 uses : actions/checkout@v3
@@ -238,7 +270,7 @@ jobs:
238270 run : |
239271 cd $GITHUB_WORKSPACE/box-openapi
240272 yarn install
241- yarn build
273+ yarn build:content
242274
243275 - name : Check out the Codegen repo
244276 uses : actions/checkout@v3
@@ -254,5 +286,5 @@ jobs:
254286 npm install
255287 cd scripts
256288 npm install
257- cp $GITHUB_WORKSPACE/box-openapi/compiled/openapi /openapi.json .
289+ cp $GITHUB_WORKSPACE/box-openapi/compiled/content /openapi.json .
258290 npm run validate ./openapi.json
0 commit comments