From a8df40a7c52926c08ccf6dc2937e96845598d23d Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Fri, 4 Dec 2020 04:02:13 -0500 Subject: [PATCH 01/24] initial openapi publishing --- .circleci/config.yml | 47 +++++++++++++++++++++++++++++++++++++-- .circleci/publish.js | 53 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 6 ++++- 3 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 .circleci/publish.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 35ae1344..7617eaf3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2.1 jobs: - build: + validate: working_directory: ~/stac docker: - image: circleci/node:12 @@ -14,4 +14,47 @@ jobs: command: npm install - run: name: validate - command: npm run check \ No newline at end of file + command: npm run check + build: + working_directory: ~/stac + docker: + - image: circleci/node:12 + steps: + - checkout + - run: + name: build openapi + command: echo build openapi + publish: + working_directory: ~/stac + docker: + - image: circleci/node:12 + steps: + - checkout + - run: + name: install + command: npm install + - add_ssh_keys: + fingerprints: + - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" + - run: + name: publish + command: echo publish openapi #npm run publish -- $CIRCLE_TAG + +workflows: + version: 2 + ci: + jobs: + - validate + - build: + requires: + - validate + - publish: + requires: + - build + filters: + tags: + # All (future) tags + only: /.+/ + branches: + # Only dev branch, not PRs + only: dev \ No newline at end of file diff --git a/.circleci/publish.js b/.circleci/publish.js new file mode 100644 index 00000000..c3012312 --- /dev/null +++ b/.circleci/publish.js @@ -0,0 +1,53 @@ +const klaw = require('klaw-sync'); +const path = require('path'); +const fs = require('fs'); +const ghpages = require('gh-pages'); +const loader = require('speccy/lib/loader'); + +function filterFn (item) { + const basename = path.basename(item.path); + return basename === '.' || basename[0] !== '.' + && basename !== 'node_modules' && basename !== 'fragments' && basename !== 'extensions' +} + +let args = process.argv.slice(2); +let tag = 'dev'; +if (args.length && args[0].trim().length > 0) { + tag = args[0]; +} + +const options = { + resolve: true, // Resolve external references + jsonSchema: true // Treat $ref like JSON Schema and convert to OpenAPI Schema Objects + }; + +var folder = '.'; +for (let file of klaw(folder, {filter: filterFn})) { + if (!file.stats.isDirectory() && file.path.endsWith('openapi.yaml')) { + let target = 'build' + path.sep + tag + path.sep + path.relative(folder, file.path); + console.log(target); + loader + .loadSpec(file.path, options) // Load the spec... + .then(spec => { + + fs.writeFileSync(target, JSON.stringify(spec)) + + }); + + } +} + +/* +ghpages.publish('schemas/' + tag, { + src: '**', + dest: tag, + message: 'Publish JSON Schemas [ci skip]', + user: { + name: 'STAC CI', + email: 'ci@stacspec.org' + } +}, error => { + console.error(error ? error : 'Deployed to gh-pages'); + process.exit(error ? 1 : 0); +}); +*/ \ No newline at end of file diff --git a/package.json b/package.json index cddc14d6..26b3d67c 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,13 @@ "check-openapi-commons": "spectral lint core/commons.yaml --ruleset .circleci/.spectral-fragments.yml", "check-openapi-ogcapi-features": "spectral lint ogcapi-features/openapi.yaml ogcapi-features/extensions/*/openapi.yaml --ruleset .circleci/.spectral.yml", "check-openapi-item-search": "spectral lint item-search/openapi.yaml --ruleset .circleci/.spectral.yml", - "check-openapi-fragments": "spectral lint fragments/*/openapi.yaml --ruleset .circleci/.spectral-fragments.yml" + "check-openapi-fragments": "spectral lint fragments/*/openapi.yaml --ruleset .circleci/.spectral-fragments.yml", + "publish": "node .circleci/publish.js" }, "dependencies": { "@stoplight/spectral": "^5.7.1", + "gh-pages": "^3.1.0", + "klaw-sync": "^6.0.0", "redoc-cli": "^0.10.2", "remark-cli": "^8.0.1", "remark-lint": "^7.0.1", @@ -25,6 +28,7 @@ "remark-preset-lint-markdown-style-guide": "^3.0.1", "remark-preset-lint-recommended": "^4.0.1", "remark-validate-links": "^10.0.2", + "speccy": "^0.11.0", "yaml-files": "^1.1.0" } } From e254cdb6257ffd39149c3e0e71fec962dd4143c3 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Mon, 7 Dec 2020 18:34:49 -0500 Subject: [PATCH 02/24] ci: make working directory --- .circleci/publish.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/publish.js b/.circleci/publish.js index c3012312..6f60cc77 100644 --- a/.circleci/publish.js +++ b/.circleci/publish.js @@ -25,13 +25,15 @@ var folder = '.'; for (let file of klaw(folder, {filter: filterFn})) { if (!file.stats.isDirectory() && file.path.endsWith('openapi.yaml')) { let target = 'build' + path.sep + tag + path.sep + path.relative(folder, file.path); + const dir = path.dirname(target) + if (!fs.existsSync(dir)){ + fs.mkdirSync(dir, {recursive: true}); + } console.log(target); loader - .loadSpec(file.path, options) // Load the spec... + .loadSpec(file.path, options) .then(spec => { - fs.writeFileSync(target, JSON.stringify(spec)) - }); } From db49d7d7867ae02e56445733eba1d8097708ec14 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 00:48:56 -0500 Subject: [PATCH 03/24] use publish script just for publishing --- .circleci/publish.js | 45 ++------------------------------------------ 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/.circleci/publish.js b/.circleci/publish.js index 6f60cc77..3adf314d 100644 --- a/.circleci/publish.js +++ b/.circleci/publish.js @@ -1,48 +1,8 @@ -const klaw = require('klaw-sync'); -const path = require('path'); -const fs = require('fs'); const ghpages = require('gh-pages'); -const loader = require('speccy/lib/loader'); -function filterFn (item) { - const basename = path.basename(item.path); - return basename === '.' || basename[0] !== '.' - && basename !== 'node_modules' && basename !== 'fragments' && basename !== 'extensions' -} -let args = process.argv.slice(2); -let tag = 'dev'; -if (args.length && args[0].trim().length > 0) { - tag = args[0]; -} - -const options = { - resolve: true, // Resolve external references - jsonSchema: true // Treat $ref like JSON Schema and convert to OpenAPI Schema Objects - }; - -var folder = '.'; -for (let file of klaw(folder, {filter: filterFn})) { - if (!file.stats.isDirectory() && file.path.endsWith('openapi.yaml')) { - let target = 'build' + path.sep + tag + path.sep + path.relative(folder, file.path); - const dir = path.dirname(target) - if (!fs.existsSync(dir)){ - fs.mkdirSync(dir, {recursive: true}); - } - console.log(target); - loader - .loadSpec(file.path, options) - .then(spec => { - fs.writeFileSync(target, JSON.stringify(spec)) - }); - - } -} - -/* -ghpages.publish('schemas/' + tag, { +ghpages.publish('build/', { src: '**', - dest: tag, message: 'Publish JSON Schemas [ci skip]', user: { name: 'STAC CI', @@ -51,5 +11,4 @@ ghpages.publish('schemas/' + tag, { }, error => { console.error(error ? error : 'Deployed to gh-pages'); process.exit(error ? 1 : 0); -}); -*/ \ No newline at end of file +}); \ No newline at end of file From f014ec887c76c614012da3eb4722ffdc3e89970a Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 00:49:49 -0500 Subject: [PATCH 04/24] ci: build openapi --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7617eaf3..a97d3210 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: - checkout - run: name: build openapi - command: echo build openapi + command: .circleci/build-openapi.sh publish: working_directory: ~/stac docker: From 2604492937c8f7d756ac5aaa34dc3a94587f808d Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 00:53:10 -0500 Subject: [PATCH 05/24] ci: setup scripts for build and publish openapi --- .circleci/config.yml | 4 ++-- package.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a97d3210..e204090a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: - checkout - run: name: build openapi - command: .circleci/build-openapi.sh + command: npm run build-openapi publish: working_directory: ~/stac docker: @@ -38,7 +38,7 @@ jobs: - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" - run: name: publish - command: echo publish openapi #npm run publish -- $CIRCLE_TAG + command: npm run publish-openapi workflows: version: 2 diff --git a/package.json b/package.json index 26b3d67c..13eba49b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "check-openapi-ogcapi-features": "spectral lint ogcapi-features/openapi.yaml ogcapi-features/extensions/*/openapi.yaml --ruleset .circleci/.spectral.yml", "check-openapi-item-search": "spectral lint item-search/openapi.yaml --ruleset .circleci/.spectral.yml", "check-openapi-fragments": "spectral lint fragments/*/openapi.yaml --ruleset .circleci/.spectral-fragments.yml", - "publish": "node .circleci/publish.js" + "build-openapi": ".circleci/build-openapi.sh", + "publish-openapi": "node .circleci/publish.js" }, "dependencies": { "@stoplight/spectral": "^5.7.1", From 1ed0bcc34b4bd405005ba64b9c8c355e2f3cc80e Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 00:54:00 -0500 Subject: [PATCH 06/24] ci: add openapi build script --- .circleci/build-openapi.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 .circleci/build-openapi.sh diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh new file mode 100755 index 00000000..4b8d07d4 --- /dev/null +++ b/.circleci/build-openapi.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +PATH=./node_modules/.bin:$PATH + +# get version argument, or default to `dev` +VERSION=${1:-dev} + +# find all OpenAPI docs that are not fragments +FNAMES=`find . -name "openapi.yaml" -not -path "./fragments/*" -not -path "./node_modules/*"` + +# use speccy to resolve +for fin in $FNAMES; do + fout=./build/$VERSION/$fin + mkdir -p ${fout%/*} + speccy resolve $fin > $fout +done \ No newline at end of file From 367024e8718bdb2b8c70c8a63288abfb9cfde9e5 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 00:59:10 -0500 Subject: [PATCH 07/24] ci: updated config --- .circleci/config.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e204090a..aa197c16 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,9 @@ jobs: - image: circleci/node:12 steps: - checkout + - run: + name: install + command: npm install - run: name: build openapi command: npm run build-openapi @@ -30,12 +33,15 @@ jobs: - image: circleci/node:12 steps: - checkout - - run: - name: install - command: npm install - add_ssh_keys: fingerprints: - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" + - run: + name: install + command: npm install + - run: + name: build openapi + command: npm run build-openapi - run: name: publish command: npm run publish-openapi From c95c1c3e8d146dbab9773a84a942d947e70db69b Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:07:10 -0500 Subject: [PATCH 08/24] ci: update fingerprint --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa197c16..7d7bf34e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - checkout - add_ssh_keys: fingerprints: - - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" + - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" - run: name: install command: npm install From fa8762e580db5b02b88a46d6a1f5f25e7b99b057 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:28:50 -0500 Subject: [PATCH 09/24] publish to specific directory --- .circleci/publish.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/publish.js b/.circleci/publish.js index 3adf314d..142429c8 100644 --- a/.circleci/publish.js +++ b/.circleci/publish.js @@ -1,8 +1,14 @@ const ghpages = require('gh-pages'); +let args = process.argv.slice(2); +let tag = 'dev'; +if (args.length && args[0].trim().length > 0) { + tag = args[0]; +} -ghpages.publish('build/', { +ghpages.publish('build/' + tag, { src: '**', + dest: tag, message: 'Publish JSON Schemas [ci skip]', user: { name: 'STAC CI', From 1e804444899a793d11c60f4fe2a51e95e28ff127 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:29:10 -0500 Subject: [PATCH 10/24] ci: add caching between jobs --- .circleci/config.yml | 51 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d7bf34e..033b67f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,23 @@ version: 2.1 + +references: + restore_repo: &restore_repo + restore_cache: + keys: + - v1-repo-{{ .Branch }}-{{ .Revision }} + - v1-repo-{{ .Branch }} + - v1-repo + restore_dependencies: + restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json"}} + - v1-dependencies + restore_build: + restore_cache: + keys: + - v1-build-{{ .Branch }}-{{ .Revision }} + + jobs: validate: working_directory: ~/stac @@ -9,9 +28,17 @@ jobs: - run: name: init_submodules command: git submodule update --init --recursive + - save_cache: + key: v1-repo-{{ .Branch }}-{{ .Revision }} + paths: + - ./ - run: name: install command: npm install + - save_cache: + key: v1-dependencies-{{ checksum "package.json"}} + paths: + - ~/node_modules - run: name: validate command: npm run check @@ -20,31 +47,29 @@ jobs: docker: - image: circleci/node:12 steps: - - checkout - - run: - name: install - command: npm install + - *restore_repo + - *restore_dependencies - run: name: build openapi - command: npm run build-openapi + command: npm run build-openapi -- $CIRCLE_TAG + - save_cache: + key: v1-build-{{ .Branch }}-{{ .Revision }} + paths: + - ~/build publish: working_directory: ~/stac docker: - image: circleci/node:12 steps: - - checkout - add_ssh_keys: fingerprints: - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" - - run: - name: install - command: npm install - - run: - name: build openapi - command: npm run build-openapi + - *restore_repo + - *restore_dependencies + - *restore_build - run: name: publish - command: npm run publish-openapi + command: npm run publish-openapi -- $CIRCLE_TAG workflows: version: 2 From adf1a66982e783fc905ea07c0c55a36d36dfa47d Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:34:25 -0500 Subject: [PATCH 11/24] ci: add yaml reference anchors --- .circleci/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 033b67f9..d670526d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,17 +7,18 @@ references: - v1-repo-{{ .Branch }}-{{ .Revision }} - v1-repo-{{ .Branch }} - v1-repo - restore_dependencies: + + restore_dependencies: &restore_dependencies restore_cache: keys: - v1-dependencies-{{ checksum "package.json"}} - v1-dependencies - restore_build: + restore_build: &restore_build restore_cache: keys: - v1-build-{{ .Branch }}-{{ .Revision }} - + jobs: validate: working_directory: ~/stac From 4dc662700fb36eae8eb65bddf8dae958aa7b7a23 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:56:21 -0500 Subject: [PATCH 12/24] ci: fix cache paths --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d670526d..548c5587 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ jobs: - save_cache: key: v1-dependencies-{{ checksum "package.json"}} paths: - - ~/node_modules + - node_modules - run: name: validate command: npm run check @@ -56,7 +56,7 @@ jobs: - save_cache: key: v1-build-{{ .Branch }}-{{ .Revision }} paths: - - ~/build + - build publish: working_directory: ~/stac docker: From 08637a72c4edb04d7a29f1fa827d3d66bf310f43 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 01:59:23 -0500 Subject: [PATCH 13/24] ci: explicit paths --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 548c5587..dca6dc63 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,14 +32,14 @@ jobs: - save_cache: key: v1-repo-{{ .Branch }}-{{ .Revision }} paths: - - ./ + - ~/stac - run: name: install command: npm install - save_cache: key: v1-dependencies-{{ checksum "package.json"}} paths: - - node_modules + - ./node_modules - run: name: validate command: npm run check @@ -56,7 +56,7 @@ jobs: - save_cache: key: v1-build-{{ .Branch }}-{{ .Revision }} paths: - - build + - ./build publish: working_directory: ~/stac docker: From 795fbb4a35807784fd8321e89ffb5c8004ac35f7 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:04:12 -0500 Subject: [PATCH 14/24] ci: specify paths with working directory --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dca6dc63..e0fe0599 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,7 @@ references: keys: - v1-dependencies-{{ checksum "package.json"}} - v1-dependencies + restore_build: &restore_build restore_cache: keys: @@ -39,7 +40,7 @@ jobs: - save_cache: key: v1-dependencies-{{ checksum "package.json"}} paths: - - ./node_modules + - ~/stac/node_modules - run: name: validate command: npm run check @@ -56,7 +57,7 @@ jobs: - save_cache: key: v1-build-{{ .Branch }}-{{ .Revision }} paths: - - ./build + - ~/stac/build publish: working_directory: ~/stac docker: From 4560867f2cbece40037c128d4b003ae383f67481 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:07:15 -0500 Subject: [PATCH 15/24] ci: rename caches --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e0fe0599..8c82a96f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,20 +4,20 @@ references: restore_repo: &restore_repo restore_cache: keys: - - v1-repo-{{ .Branch }}-{{ .Revision }} - - v1-repo-{{ .Branch }} - - v1-repo + - v0-repo-{{ .Branch }}-{{ .Revision }} + - v0-repo-{{ .Branch }} + - v0-repo restore_dependencies: &restore_dependencies restore_cache: keys: - - v1-dependencies-{{ checksum "package.json"}} - - v1-dependencies + - v0-dependencies-{{ checksum "package.json"}} + - v0-dependencies restore_build: &restore_build restore_cache: keys: - - v1-build-{{ .Branch }}-{{ .Revision }} + - v0-build-{{ .Branch }}-{{ .Revision }} jobs: @@ -31,14 +31,14 @@ jobs: name: init_submodules command: git submodule update --init --recursive - save_cache: - key: v1-repo-{{ .Branch }}-{{ .Revision }} + key: v0-repo-{{ .Branch }}-{{ .Revision }} paths: - ~/stac - run: name: install command: npm install - save_cache: - key: v1-dependencies-{{ checksum "package.json"}} + key: v0-dependencies-{{ checksum "package.json"}} paths: - ~/stac/node_modules - run: @@ -55,7 +55,7 @@ jobs: name: build openapi command: npm run build-openapi -- $CIRCLE_TAG - save_cache: - key: v1-build-{{ .Branch }}-{{ .Revision }} + key: v0-build-{{ .Branch }}-{{ .Revision }} paths: - ~/stac/build publish: From d52097b4fe9f26c18da3224ec09455d204c259fd Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:09:52 -0500 Subject: [PATCH 16/24] ci: add fingerprint --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c82a96f..2428759d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,6 +66,7 @@ jobs: - add_ssh_keys: fingerprints: - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" + - "SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8" - *restore_repo - *restore_dependencies - *restore_build From fdc35c4ade6f9d0609560a24315440a552fdf4d6 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:12:03 -0500 Subject: [PATCH 17/24] ci: reset fingerprint --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2428759d..6ba8b5e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,8 +65,7 @@ jobs: steps: - add_ssh_keys: fingerprints: - - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" - - "SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8" + - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" - *restore_repo - *restore_dependencies - *restore_build From c5611cd9085695d52a21ffe7669370b3cc557c44 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:20:09 -0500 Subject: [PATCH 18/24] ci: move add fingerprints --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ba8b5e3..5f79ef56 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,12 +63,12 @@ jobs: docker: - image: circleci/node:12 steps: - - add_ssh_keys: - fingerprints: - - "9b:0a:88:ff:12:d1:29:9a:ff:bb:72:ab:7d:81:df:59" - *restore_repo - *restore_dependencies - *restore_build + - add_ssh_keys: + fingerprints: + - "SHA256:IgC7ttVAQfqV1bf8ppMXRYQkVuvlwfR6rMGPxFp9AX4" - run: name: publish command: npm run publish-openapi -- $CIRCLE_TAG From caff37a4d1910c476c1b2bae85fe5d31a6c43888 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:23:00 -0500 Subject: [PATCH 19/24] ci: revert fingerprint --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f79ef56..46f49da0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,7 @@ jobs: - *restore_build - add_ssh_keys: fingerprints: - - "SHA256:IgC7ttVAQfqV1bf8ppMXRYQkVuvlwfR6rMGPxFp9AX4" + - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" - run: name: publish command: npm run publish-openapi -- $CIRCLE_TAG From aefb3c887e9e206dab05a287ace95cdcf0db8dad Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:28:20 -0500 Subject: [PATCH 20/24] ci: remove fingerprints --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46f49da0..8a520400 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,9 +66,7 @@ jobs: - *restore_repo - *restore_dependencies - *restore_build - - add_ssh_keys: - fingerprints: - - "e1:e0:a2:73:2c:5a:61:c4:51:8f:ec:ac:08:f3:a0:5b" + - add_ssh_keys - run: name: publish command: npm run publish-openapi -- $CIRCLE_TAG From c49ef870faca93c72619fd3473830f7c959f19ac Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:32:13 -0500 Subject: [PATCH 21/24] ci: add github as known host --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a520400..b0f32903 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,7 +69,9 @@ jobs: - add_ssh_keys - run: name: publish - command: npm run publish-openapi -- $CIRCLE_TAG + command: | + ssh-keyscan -p 443 ssh.github.com >> ~/.ssh/known_hosts + npm run publish-openapi -- $CIRCLE_TAG workflows: version: 2 From d94ddaea0f74d5ce2cee445379a5cd86e743e9df Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:34:39 -0500 Subject: [PATCH 22/24] ci: change ssh-keyscan cmd for publish --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0f32903..d165e878 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,7 +70,7 @@ jobs: - run: name: publish command: | - ssh-keyscan -p 443 ssh.github.com >> ~/.ssh/known_hosts + ssh-keyscan github.com >> ~/.ssh/known_hosts npm run publish-openapi -- $CIRCLE_TAG workflows: From 60b2f0131a83396a0b9c406c32cc103e0b81f644 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 02:43:39 -0500 Subject: [PATCH 23/24] ci: remove version from local build, only in publish --- .circleci/build-openapi.sh | 5 +---- .circleci/config.yml | 2 +- .circleci/publish.js | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 4b8d07d4..583493b6 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -2,15 +2,12 @@ PATH=./node_modules/.bin:$PATH -# get version argument, or default to `dev` -VERSION=${1:-dev} - # find all OpenAPI docs that are not fragments FNAMES=`find . -name "openapi.yaml" -not -path "./fragments/*" -not -path "./node_modules/*"` # use speccy to resolve for fin in $FNAMES; do - fout=./build/$VERSION/$fin + fout=./build/$fin mkdir -p ${fout%/*} speccy resolve $fin > $fout done \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index d165e878..230a60a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,7 @@ jobs: - *restore_dependencies - run: name: build openapi - command: npm run build-openapi -- $CIRCLE_TAG + command: npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} paths: diff --git a/.circleci/publish.js b/.circleci/publish.js index 142429c8..01f829e6 100644 --- a/.circleci/publish.js +++ b/.circleci/publish.js @@ -6,7 +6,7 @@ if (args.length && args[0].trim().length > 0) { tag = args[0]; } -ghpages.publish('build/' + tag, { +ghpages.publish('build/', { src: '**', dest: tag, message: 'Publish JSON Schemas [ci skip]', From 98aedd4591878263552737238cb0888f3d0675f3 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 14:33:32 -0500 Subject: [PATCH 24/24] ci: enable builds and publish with tags --- .circleci/config.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 230a60a9..70cf716f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,17 +77,22 @@ workflows: version: 2 ci: jobs: - - validate + - validate: + filters: + tags: + only: /^v.*/ - build: requires: - validate + filters: + tags: + only: /^v.*/ - publish: requires: - build filters: tags: - # All (future) tags - only: /.+/ + only: /^v.*/ branches: # Only dev branch, not PRs only: dev \ No newline at end of file