Skip to content

Commit

Permalink
chore: setup automatic RC releases for v3 branch (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed May 21, 2020
1 parent aff5b62 commit 8a4a396
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 35 deletions.
109 changes: 87 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -38,11 +38,15 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
# This also runs a build as part of the postinstall bootstrap
- name: Install dependencies and build
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile
yarn check-clean-workspace-after-install
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn build
# Note that this command *also* type checks tests/tools,
# whereas the build only checks src files
Expand Down Expand Up @@ -84,14 +88,18 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
# This also runs a build as part of the postinstall bootstrap
- name: Install dependencies and build
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn --ignore-engines --frozen-lockfile
yarn check-clean-workspace-after-install
yarn build
- name: Check code formatting
run: yarn format-check
run: yarn check:format

- name: Lint code
run: yarn lint
Expand Down Expand Up @@ -124,14 +132,18 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
# This also runs a build as part of the postinstall bootstrap
- name: Install dependencies and build
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn --ignore-engines --frozen-lockfile
yarn check-clean-workspace-after-install
yarn build
- name: Run integrations tests
run: yarn integration-tests
run: yarn test:integration
env:
CI: true

Expand Down Expand Up @@ -160,11 +172,15 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
# This also runs a build as part of the postinstall bootstrap
- name: Install dependencies and build
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile
yarn check-clean-workspace-after-install
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn build
- name: Run unit tests
# the internal plugin is only run locally, so it doesn't have to support older versions
Expand Down Expand Up @@ -201,13 +217,62 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
# This also runs a build as part of the postinstall bootstrap
- name: Install dependencies and build
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile
yarn check-clean-workspace-after-install
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn build
- name: Publish all packages to npm
run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# TODO - delete this before merging v3 into master
publish_v3_prerelease_version:
name: Publish the latest code as a v3 prerelease version
runs-on: ubuntu-latest
needs: [primary_code_validation_and_tests, unit_tests_on_other_node_versions, linting_and_style, integration_tests]
if: github.ref == 'refs/heads/v3'
steps:
- uses: actions/checkout@v2
# Fetch all history for all tags and branches in this job because lerna needs it
- run: |
git fetch --prune --unshallow
- name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
registry-url: https://registry.npmjs.org/

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn lerna:init
yarn check:clean-workspace-after-install
- name: Build
run: |
yarn build
- name: Publish all packages to npm
run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v3
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 14 additions & 13 deletions package.json
Expand Up @@ -18,25 +18,26 @@
},
"scripts": {
"build": "lerna run build",
"clean": "lerna clean && lerna run clean",
"cz": "git-cz",
"check:docs": "lerna run check:docs",
"check:clean-workspace-after-install": "git diff --quiet --exit-code",
"check:configs": "lerna run check:configs",
"check:docs": "lerna run check:docs",
"check:format": "prettier --list-different \"./**/*.{ts,js,json,md}\"",
"check:spelling": "cspell --config=.cspell.json \"**/*.{md,ts,js}\"",
"generate-contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate",
"clean": "lerna clean && lerna run clean",
"cz": "git-cz",
"format": "prettier --write \"./**/*.{ts,js,json,md}\"",
"format-check": "prettier --list-different \"./**/*.{ts,js,json,md}\"",
"integration-tests": "./tests/integration/run-all-tests.sh",
"kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local",
"lint": "eslint . --ext .js,.ts",
"lint-fix": "eslint . --ext .js,.ts --fix",
"lint:markdown": "markdownlint '**/*.md' --config=.markdownlint.json --ignore-path=.markdownlintignore",
"generate:contributors": "yarn ts-node --transpile-only ./tools/generate-contributors.ts && yarn all-contributors generate",
"lerna:init": "lerna bootstrap --ignore-scripts && lerna link --force-local",
"lint:fix": "eslint . --ext .js,.ts --fix",
"lint:markdown:fix": "lint:markdown --fix",
"lint:markdown": "markdownlint '**/*.md' --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint": "eslint . --ext .js,.ts",
"postinstall": "yarn lerna-init && yarn build",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn format-check",
"postinstall": "lerna bootstrap -- --ignore-engines && yarn build && lerna link",
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
"pre-push": "yarn check:format",
"test": "lerna run test --concurrency 1",
"test:integration": "./tests/integration/run-all-tests.sh",
"test:kill-integration-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local",
"typecheck": "lerna run typecheck"
},
"config": {
Expand Down

0 comments on commit 8a4a396

Please sign in to comment.