From 711c5206788cfe31602083d0f85c09567508d2c6 Mon Sep 17 00:00:00 2001 From: Peter Pistorius Date: Sun, 10 May 2020 12:01:51 +0200 Subject: [PATCH] Add GH workflow to publish canary releases. --- .github/workflows/publish-npm-canary.yaml | 43 +++++++++++++++++++++++ packages/eslint-config/index.js | 7 ++-- packages/eslint-config/package.json | 2 +- tasks/publish-canary | 2 +- yarn.lock | 5 --- 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/publish-npm-canary.yaml diff --git a/.github/workflows/publish-npm-canary.yaml b/.github/workflows/publish-npm-canary.yaml new file mode 100644 index 000000000000..216e7fda1192 --- /dev/null +++ b/.github/workflows/publish-npm-canary.yaml @@ -0,0 +1,43 @@ +# TODO: Figure out how to make this workflow depend on the build, lint, test +# workflow. Then we don't have to double down on these run tasks. + +name: Publish canaray packages to npm + +on: + push: + branches: [master] + tags-ignore: [v*] # We do not want to publish a canary release when we're publish an actual release + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # Required because lerna uses tags to determine the version. + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: '12' + - name: Print node and yarn versions + run: | + node --version + yarn --version + - name: Install dependencies + run: yarn install --frozen-lockfile --check-files + - name: Run ESLint + run: yarn lint + env: + CI: true + - name: Build + run: yarn build + - name: Run tests + run: yarn test + env: + CI: true + - name: Publish to npm + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc + ./tasks/publish-canary + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/packages/eslint-config/index.js b/packages/eslint-config/index.js index b74292994b1a..ecd804e4f90d 100644 --- a/packages/eslint-config/index.js +++ b/packages/eslint-config/index.js @@ -12,8 +12,9 @@ let supportRedwoodAutoPageImports = false try { - // This will throw if the module cannot be resolved, it will not - // resolve if the module is not built, in which case we're probably + // This will throw if the module cannot be resolved, + // it will not resolve if the module is not built, + // in which case we're probably // building the framework and don't need this plugin. require.resolve('@redwoodjs/eslint-plugin-redwood') supportRedwoodAutoPageImports = { @@ -37,7 +38,7 @@ module.exports = { 'react', 'react-hooks', 'jest-dom', - supportRedwoodAutoPageImports && '@redwoodjs/redwood', // @redwoodjs/redwood-eslint-plugin + supportRedwoodAutoPageImports && '@redwoodjs/eslint-plugin-redwood', ].filter(Boolean), ignorePatterns: ['node_modules', 'dist'], extends: [ diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 1fb3e579dc1e..c47d58bacfd7 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -4,7 +4,7 @@ "main": "index.js", "license": "MIT", "dependencies": { - "@redwoodjs/eslint-plugin-redwood": "^0.4.0", + "@redwoodjs/eslint-plugin-redwood": "0.6.0", "@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/parser": "^2.27.0", "babel-eslint": "^10.1.0", diff --git a/tasks/publish-canary b/tasks/publish-canary index 0c60c4b7b0f0..fcbf102317db 100755 --- a/tasks/publish-canary +++ b/tasks/publish-canary @@ -1,7 +1,7 @@ #!/bin/bash # This publishes a "canary" version of our packages to npm. -# It is intended to be run when a package is merged to master. +# It is run when a branch is merged to master. # https://github.com/lerna/lerna/tree/master/commands/publish#--canary yarn lerna publish --force-publish --canary --preid canary --dist-tag canary --yes \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 96c804e075ff..1f81b9e21c48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2306,11 +2306,6 @@ resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= -"@redwoodjs/eslint-plugin-redwood@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@redwoodjs/eslint-plugin-redwood/-/eslint-plugin-redwood-0.4.0.tgz#0f89655811c09f662bcdc92596de01575b5af796" - integrity sha512-yF2gIBhg/AipzXGIZP+u1+OjwZrIuOTm3KEhADm26Qxri87WgHLFuPdyN3LYEjew71qIb0Q9OUQqgPMSNwxYfg== - "@rollup/plugin-commonjs@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.1.tgz#6056a6757286901cc6c1599123e6680a78cad6c2"