From eb08b8bb01382c49815a80ee658469d078cc7c84 Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Tue, 19 Jan 2021 19:17:19 +0000 Subject: [PATCH 1/7] chore: test release-please flow --- .github/workflows/release-please.yml | 16 ++++++++++++++++ .github/workflows/swagger-bump.yml | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/release-please.yml create mode 100644 .github/workflows/swagger-bump.yml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..7453686c --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,16 @@ +name: release-please +on: + push: + branches: + - test/release-flow +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + token: ${{ secrets.NODE_PKG_RELEASE_TOKEN }} + release-type: node + package-name: '@netlify/open-api' + if: ${{ !steps.release.outputs.release_created }} diff --git a/.github/workflows/swagger-bump.yml b/.github/workflows/swagger-bump.yml new file mode 100644 index 00000000..50940f12 --- /dev/null +++ b/.github/workflows/swagger-bump.yml @@ -0,0 +1,19 @@ +name: swagger-bump +on: + push: + branches: + - release-* +jobs: + swagger-bump: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: 'https://registry.npmjs.org' + - run: npm install + - run: npm version:1-swagger + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Bump swagger.yml file" From 686d2517e30d0a25045f865c7c0991f697c68bf0 Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Tue, 19 Jan 2021 19:26:10 +0000 Subject: [PATCH 2/7] fix: github token in workflow --- .github/workflows/release-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7453686c..be9f51d8 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -10,7 +10,7 @@ jobs: - uses: GoogleCloudPlatform/release-please-action@v2 id: release with: - token: ${{ secrets.NODE_PKG_RELEASE_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} release-type: node package-name: '@netlify/open-api' if: ${{ !steps.release.outputs.release_created }} From b985d27f1e7f44ef3a090ca61c1dfb44ef2cde6f Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Wed, 20 Jan 2021 13:11:15 +0000 Subject: [PATCH 3/7] fix: switch branches and cleanup package.json --- .github/workflows/release-please.yml | 7 ++++--- .github/workflows/swagger-bump.yml | 3 ++- package.json | 4 +--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index be9f51d8..b8b9d700 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -2,7 +2,7 @@ name: release-please on: push: branches: - - test/release-flow + - master jobs: release-please: runs-on: ubuntu-latest @@ -10,7 +10,8 @@ jobs: - uses: GoogleCloudPlatform/release-please-action@v2 id: release with: - token: ${{ secrets.GITHUB_TOKEN }} + # We can't rely on the GITHUB_TOKEN as we need to trigger + # further actions and the GITHUB_TOKEN doesn't allow it + token: ${{ secrets.NODE_PKG_RELEASE_TOKEN }} release-type: node package-name: '@netlify/open-api' - if: ${{ !steps.release.outputs.release_created }} diff --git a/.github/workflows/swagger-bump.yml b/.github/workflows/swagger-bump.yml index 50940f12..b12b53e1 100644 --- a/.github/workflows/swagger-bump.yml +++ b/.github/workflows/swagger-bump.yml @@ -1,5 +1,6 @@ name: swagger-bump on: + # Workaround for bumping the swagger.yml file on release-please PRs push: branches: - release-* @@ -16,4 +17,4 @@ jobs: - run: npm version:1-swagger - uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: "Bump swagger.yml file" + commit_message: "chore: bump swagger.yml file" diff --git a/package.json b/package.json index d31fd5b6..4426ee7e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "devDependencies": { "analytics": "^0.2.0", "analytics-plugin-ga": "^0.1.5", - "auto-changelog": "^1.16.1", "ava": "^2.4.0", "cp-file": "^7.0.0", "eslint": "^6.3.0", @@ -58,8 +57,7 @@ "convert": "node src/convert.js", "version": "run-s version:*", "version:1-swagger": "node src/bump-swagger.js", - "version:2-changelog": "auto-changelog -p --template keepachangelog --breaking-pattern breaking", - "version:3-git": "git add CHANGELOG.md swagger.yml", + "version:2-git": "git add swagger.yml", "redoc": "node src/docs/build.js", "lint": "run-s eslint prettier", "eslint": "eslint --fix \"src/**/*.js\"", From 2976822bdfcb55fddebecaf574b86069156f248b Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Wed, 20 Jan 2021 14:53:07 +0000 Subject: [PATCH 4/7] chore: update CONTRIBUTING.md --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16c79c59..80f58ade 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,17 +32,17 @@ You may first want to edit swagger.yml to add your field or endpoint definitions ## Making PRs -1. Don't bump the version number for `swagger.yml` changes. Do that during the release process. +1. Don't bump the version number for `swagger.yml` changes. The release process handles that. 2. Ensure `make validate` passes. 3. The go tests run against the last generated go client. These must pass before making a release. 4. If all you want is a new endpoint, you can PR just the `swagger.yml` changes for review and regenerate the go client when its ready to go in. ## Making a new release -1. Make sure you are on the HEAD of the master branch. -2. regenarate go client (if you haven't) (Make all and commit the results) -3. bump a JS package version with `npm version [major|minor|patch]` (updates package.json, swagger.yaml and create a git tag) -4. Run `npm publish` which will as `git push && git push --tags` to push to the origin, create a github release and publish the spec to npm. +1. Merge the release PR (auto generated via `release-please`). +2. Switch to the default branch git checkout master. +3. Pull latest changes git pull. +4. Run `npm publish`. ## License From 3fc3147da06562124a7601ecdfcb41bb43cbe9f8 Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Wed, 20 Jan 2021 14:55:21 +0000 Subject: [PATCH 5/7] chore: update CONTRIBUTING.md with conventional commits guidelines --- CONTRIBUTING.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80f58ade..d6c7286c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,10 +32,11 @@ You may first want to edit swagger.yml to add your field or endpoint definitions ## Making PRs -1. Don't bump the version number for `swagger.yml` changes. The release process handles that. -2. Ensure `make validate` passes. -3. The go tests run against the last generated go client. These must pass before making a release. -4. If all you want is a new endpoint, you can PR just the `swagger.yml` changes for review and regenerate the go client when its ready to go in. +1. Make sure your PR title and commits follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) spec. +2. Don't bump the version number for `swagger.yml` changes. The release process handles that. +3. Ensure `make validate` passes. +4. The go tests run against the last generated go client. These must pass before making a release. +5. If all you want is a new endpoint, you can PR just the `swagger.yml` changes for review and regenerate the go client when its ready to go in. ## Making a new release From 9a8c14a681ce5065d8ab3797cd73c5e1cae07fa9 Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Wed, 20 Jan 2021 16:43:28 +0000 Subject: [PATCH 6/7] chore: update package-lock.json --- package-lock.json | 60 ----------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2e094d11..1053b2cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -753,42 +753,6 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, - "auto-changelog": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-1.16.1.tgz", - "integrity": "sha512-1OMUN5UWWhKtlEMpGUfbLFcZHDf4IXMNU4SsGs44xTlSBhjgTOx9ukbahoC7hTqIm6+sRAnlAbLY4UjbDZY18A==", - "dev": true, - "requires": { - "commander": "^3.0.1", - "core-js": "^3.2.1", - "handlebars": "^4.1.2", - "lodash.uniqby": "^4.7.0", - "node-fetch": "^2.6.0", - "parse-github-url": "^1.0.2", - "regenerator-runtime": "^0.13.3", - "semver": "^6.3.0" - }, - "dependencies": { - "core-js": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", - "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", - "dev": true - }, - "regenerator-runtime": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", - "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "ava": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/ava/-/ava-2.4.0.tgz", @@ -2105,12 +2069,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.1.tgz", - "integrity": "sha512-UNgvDd+csKdc9GD4zjtkHKQbT8Aspt2jCBqNSPp53vAS0L1tS9sXB2TCEOPHJ7kt9bN/niWkYj8T3RQSoMXdSQ==", - "dev": true - }, "common-path-prefix": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-1.0.0.tgz", @@ -4705,12 +4663,6 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "lodash.uniqby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", - "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=", - "dev": true - }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -5112,12 +5064,6 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true - }, "node-fetch-h2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", @@ -5672,12 +5618,6 @@ "safe-buffer": "^5.1.1" } }, - "parse-github-url": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", - "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", - "dev": true - }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", From f452ce9ef86ed2b28127d042fe662401130ec71a Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Wed, 20 Jan 2021 16:44:04 +0000 Subject: [PATCH 7/7] chore(swagger-bump): use npm ci instead of install --- .github/workflows/swagger-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swagger-bump.yml b/.github/workflows/swagger-bump.yml index b12b53e1..3e013ffc 100644 --- a/.github/workflows/swagger-bump.yml +++ b/.github/workflows/swagger-bump.yml @@ -13,7 +13,7 @@ jobs: with: node-version: 12 registry-url: 'https://registry.npmjs.org' - - run: npm install + - run: npm ci - run: npm version:1-swagger - uses: stefanzweifel/git-auto-commit-action@v4 with: