Skip to content

Commit

Permalink
chore: set up auto for versioning/release management (#7984)
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Feb 23, 2022
1 parent 199d8ff commit ae13aff
Show file tree
Hide file tree
Showing 11 changed files with 1,030 additions and 64 deletions.
10 changes: 10 additions & 0 deletions .autorc.json
@@ -0,0 +1,10 @@
{
"plugins": [
"npm",
"conventional-commits",
"first-time-contributor",
"released"
],
"baseBranch": "stable",
"prereleaseBranches": ["next"]
}
2 changes: 1 addition & 1 deletion .github/workflows/merge-dependabot.yml
Expand Up @@ -13,4 +13,4 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
auto-merge: 'minor'
merge-method: 'rebase'
merge-method: 'squash'
34 changes: 34 additions & 0 deletions .github/workflows/publish-to-npm.yml
@@ -0,0 +1,34 @@
name: Publish to NPM (canaries and prereleases)

on:
push:
branches-ignore:
# No canary deploys for branches opened by dependabot
- 'dependabot/**'
# documentation site should not trigger releases
- 'gh-pages'

jobs:
publish:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"

name: Make a release and publish to NPM

steps:
- uses: actions/checkout@v2

- name: Prepare repository
run: git fetch --unshallow --tags

- uses: actions/setup-node@v2.4.0
with:
registry-url: 'https://registry.npmjs.org'

- name: Install Node dependencies
run: yarn --frozen-lockfile

- run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,8 +1,11 @@
name: Release
name: Publish Documentation and Schema

on:
release:
types: [published]
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
# The "published" event includes both releases and prereleases
# use "released" to limit triggers to official releases
types: [released]

jobs:
release:
Expand Down Expand Up @@ -37,12 +40,6 @@ jobs:
- uses: actions/setup-node@v2.5.1
with:
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM registry
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Prebuild website
run: yarn predeploy:site
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -194,7 +194,12 @@ During development, it can be convenient to rebuild automatically or to run test

### Deployment

To make a new release, bump the version number with `scripts/bump.sh 4.0.0` (you can get the current version with `scripts/bump.sh`). Then push the tagged commit that the script creates, make a new GitHub release for the tag, and update the changelog. `yarn changelog` can help generate initial draft for a changelog, though we should manually add screenshots for feature releases (major and minor). After creating a GitHub release, GitHub will run checks and make a release. This will also update the website and schema. If you want to update only GitHub Pages, use `yarn deploy:site`.
Publishing is handled by a 2-branch [pre-release process](https://intuit.github.io/auto/docs/generated/shipit#next-branch-default), configured in `publish.yml`. All changes should be based off the default `next` branch, and are published automatically.

- PRs made into the default branch are auto-deployed to the `next` pre-release tag on NPM. The result can be installed with `npm install vega-lite/@next`.
- When merging into `next`, please use the `squash and merge` strategy.
- To release a new stable version, open a PR from `next` into `stable` using this [compare link](https://github.com/vega/vega-lite/compare/stable...next).
- When merging from `next` into `stable`, please use the `create a merge commit` strategy.

## Suggested Programming Environment.

Expand Down
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -69,7 +69,8 @@
"test:runtime:generate": "yarn build:only && del-cli test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime",
"watch": "tsc -p tsconfig.build.json -w",
"watch:site": "yarn build:site -w",
"watch:test": "yarn jest --watch test/"
"watch:test": "yarn jest --watch test/",
"release": "yarn run prebuild && yarn build && auto shipit"
},
"repository": {
"type": "git",
Expand All @@ -80,6 +81,8 @@
"url": "https://github.com/vega/vega-lite/issues"
},
"devDependencies": {
"@auto-it/conventional-commits": "^10.32.6",
"@auto-it/first-time-contributor": "^10.32.6",
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-typescript": "^7.16.0",
Expand All @@ -97,6 +100,7 @@
"@typescript-eslint/parser": "^5.6.0",
"ajv": "^8.8.2",
"ajv-formats": "^2.1.1",
"auto": "^10.32.6",
"chai": "^4.3.4",
"cheerio": "^1.0.0-rc.10",
"conventional-changelog-cli": "^2.1.1",
Expand Down
26 changes: 0 additions & 26 deletions scripts/bump.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/check-and-commit-toc.sh
Expand Up @@ -7,7 +7,7 @@ git checkout $GIT_BRANCH

echo "On branch $GIT_BRANCH."

if [ "$GIT_BRANCH" != "master" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then

This comment has been minimized.

Copy link
@domoritz

domoritz Feb 25, 2022

Member

@hydrosquall I wonder whether this should be stable or next since we don't want to push new commits into next automatically. It's best to get the auto commits only in pull request branches.

This comment has been minimized.

Copy link
@hydrosquall

hydrosquall Feb 25, 2022

Author Member

I think we don't want this to be running on next or on stable, so perhaps this should be added as a 3rd clause.

[ "$GIT_BRANCH" != "next" ]

Thanks for catching this. I'll open a small hotfix: #8004

This comment has been minimized.

Copy link
@hydrosquall

hydrosquall Feb 25, 2022

Author Member

For historical records: because I missed this the first time around, we had a direct commit to next:

e9a2bd0

if [ "$GIT_BRANCH" != "stable" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then
PUSH_BRANCH=true
echo "Will try to push changes."
else
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-and-commit.sh
Expand Up @@ -7,7 +7,7 @@ git checkout $GIT_BRANCH

echo "On branch $GIT_BRANCH."

if [ "$GIT_BRANCH" != "master" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then
if [ "$GIT_BRANCH" != "stable" ] && [[ "$GIT_BRANCH" != dependabot/* ]]; then
PUSH_BRANCH=true
echo "Will try to push changes."
else
Expand All @@ -21,7 +21,7 @@ echo ""

# Commit the schema if outdated
if ! git diff --exit-code ./build/vega-lite-schema.json; then
## Only do this for master
## Only do this for stable
if [ "$PUSH_BRANCH" = true ]; then
git add ./build/vega-lite-schema.json
git commit -m "chore: update schema [ci skip]"
Expand Down
2 changes: 2 additions & 0 deletions scripts/deploy-schema.sh
Expand Up @@ -6,6 +6,8 @@ version=$(scripts/version.sh vega-lite)

pushd ../schema/vega-lite/

# Note this script is running in the context of
# github.com/vega/schema, NOT github.com/vega/vega-lite
git checkout master
git pull

Expand Down

0 comments on commit ae13aff

Please sign in to comment.