Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): v0.1.2-alpha.7 #17

Merged
merged 16 commits into from
Oct 7, 2024
Merged
17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:
runs-on: ubuntu-22.04

steps:
# Lerna needs Git tags. https://stackoverflow.com/a/76181083
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
fetch-tags: true

# Read version from 'package.json'; git tags are lost on a merged PR.
- name: Read package version
Expand Down Expand Up @@ -58,15 +62,26 @@ jobs:
- name: Build
run: yarn build

# TODO: Why do both .npmrc and .yarnrc.yml need updates?
- name: Configure yarn to publish packages
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_CARTODB_AUTH_TOKEN }}
# Ignore changes to .yarnrc.yml, see https://github.com/lerna/lerna/issues/2329
run: |
# Ignore changes to .yarnrc.yml, see https://github.com/lerna/lerna/issues/2329
git update-index --assume-unchanged .yarnrc.yml

# Update .yarnrc.yml
yarn config set npmPublishRegistry "https://registry.npmjs.org/"
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}"

# Create .npmrc
echo "@carto:registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" >> .npmrc

# Check configuration
npm config get registry
npm view @carto/create-common versions

- name: Publish
env:
DIST_TAG: ${{ steps.dist-tag.outputs.result }}
Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ During local development, CSS styles are loaded from a shared `style.css` in the

All packages are published together. To create a standard release:

1. Update changelog
1. Update changelog and commit changes

2. Create a new version:
2. Create a new version: `yarn lerna version [ major | minor | patch | prerelease ]`

- Release: `yarn lerna publish [ patch | minor | major ] --force-publish "*"`
- Prerelease: `yarn lerna publish prerelease --dist-tag alpha --force-publish "*"`
3. Push to GitHub: `yarn postversion`

4. Publish
- If working on `main`, the previous step will automatically create and push a branch. Open a pull request, get any required approvals, and merge. Merged pull requests with commit messages beginning `chore(release)` will trigger a release automatically.
- If working on a branch, a commit for the release will be pushed to the branch. You'll then need to [manually run a workflow](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow), “Release”, selecting the target branch in the menu.
17 changes: 13 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.1.2-alpha.0",
"packages": ["packages/*"],
"npmClient": "yarn"
}
"version": "0.1.2-alpha.7",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"command": {
"version": {
"message": "chore(release): %s",
"push": false,
"gitTagVersion": false
}
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
"lint": "lerna run lint",
"test": "lerna run test",
"clean": "rimraf --glob 'packages/*/dist/*' 'sandbox/*'",
"preversion": "yarn lint",
"version": "yarn clean && yarn build",
"postversion": "git push && git push --tags"
"postversion": "yarn postversion:check && yarn postversion:commit && yarn postversion:push",
"postversion:check": "yarn lint && yarn test",
"postversion:commit": "node scripts/postversion-commit.js",
"postversion:push": "git push && git push --tags",
"prepublish": "yarn lint && yarn test",
"prepack": "yarn clean && yarn build"
},
"devDependencies": {
"@types/meow": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "github:CartoDB/carto-app-templates",
"author": "Don McCurdy <[email protected]>",
"license": "MIT",
"version": "0.1.2-alpha.0",
"version": "0.1.2-alpha.7",
"type": "module",
"bin": "./scripts/create.js",
"scripts": {
Expand All @@ -25,7 +25,7 @@
"@angular/router": "^18.2.5",
"@auth0/auth0-angular": "^2.2.3",
"@carto/api-client": "^0.2.1",
"@carto/create-common": "^0.1.2-alpha.0",
"@carto/create-common": "^0.1.2-alpha.7",
"@deck.gl/aggregation-layers": "^9.0.24",
"@deck.gl/carto": "^9.0.24",
"@deck.gl/core": "^9.0.24",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@carto/create-common",
"packageManager": "[email protected]",
"author": "Don McCurdy <[email protected]>",
"version": "0.1.2-alpha.0",
"version": "0.1.2-alpha.7",
"license": "MIT",
"type": "module",
"sideEffects": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/create-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "github:CartoDB/carto-app-templates",
"author": "Don McCurdy <[email protected]>",
"license": "MIT",
"version": "0.1.2-alpha.0",
"version": "0.1.2-alpha.7",
"type": "module",
"bin": "./scripts/create.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"dependencies": {
"@auth0/auth0-react": "^2.2.4",
"@carto/api-client": "^0.2.1",
"@carto/create-common": "^0.1.2-alpha.0",
"@carto/create-common": "^0.1.2-alpha.7",
"@deck.gl/aggregation-layers": "^9.0.24",
"@deck.gl/carto": "^9.0.24",
"@deck.gl/core": "^9.0.24",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "github:CartoDB/carto-app-templates",
"author": "Don McCurdy <[email protected]>",
"license": "MIT",
"version": "0.1.2-alpha.0",
"version": "0.1.2-alpha.7",
"type": "module",
"bin": "./scripts/create.js",
"scripts": {
Expand All @@ -16,7 +16,7 @@
"dependencies": {
"@auth0/auth0-vue": "^2.3.3",
"@carto/api-client": "^0.2.1",
"@carto/create-common": "^0.1.2-alpha.0",
"@carto/create-common": "^0.1.2-alpha.7",
"@deck.gl/aggregation-layers": "^9.0.24",
"@deck.gl/carto": "^9.0.24",
"@deck.gl/core": "^9.0.24",
Expand Down
30 changes: 30 additions & 0 deletions scripts/postversion-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { execSync } from 'node:child_process';
import { readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { valid } from 'semver';

/**
* Utility for committing and tagging a release commit in
* git, called as part of the `yarn postversion` script.
*/

// Read and validate pkg.version.
const pkgJSON = await readFile(
resolve('./packages/create-react/package.json'),
'utf-8',
);
const version = 'v' + JSON.parse(pkgJSON).version;
if (!valid(version)) {
throw new Error(`Invalid version, "${version}"`);
}

// Check out a branch if cutting a version from 'main'.
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
if (branch === 'main') {
execSync(`git checkout -b 'release/${version}'`);
}

// Commit and tag.
execSync('git add -u');
execSync(`git commit -m 'chore(release): ${version}'`);
execSync(`git tag -a ${version} -m ${version}`);
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ __metadata:
"@angular/router": "npm:^18.2.5"
"@auth0/auth0-angular": "npm:^2.2.3"
"@carto/api-client": "npm:^0.2.1"
"@carto/create-common": "npm:^0.1.2-alpha.0"
"@carto/create-common": "npm:^0.1.2-alpha.7"
"@deck.gl/aggregation-layers": "npm:^9.0.24"
"@deck.gl/carto": "npm:^9.0.24"
"@deck.gl/core": "npm:^9.0.24"
Expand All @@ -2464,7 +2464,7 @@ __metadata:
languageName: unknown
linkType: soft

"@carto/create-common@npm:^0.1.2-alpha.0, @carto/create-common@workspace:packages/create-common":
"@carto/create-common@npm:^0.1.2-alpha.7, @carto/create-common@workspace:packages/create-common":
version: 0.0.0-use.local
resolution: "@carto/create-common@workspace:packages/create-common"
dependencies:
Expand All @@ -2484,7 +2484,7 @@ __metadata:
dependencies:
"@auth0/auth0-react": "npm:^2.2.4"
"@carto/api-client": "npm:^0.2.1"
"@carto/create-common": "npm:^0.1.2-alpha.0"
"@carto/create-common": "npm:^0.1.2-alpha.7"
"@deck.gl/aggregation-layers": "npm:^9.0.24"
"@deck.gl/carto": "npm:^9.0.24"
"@deck.gl/core": "npm:^9.0.24"
Expand Down Expand Up @@ -2524,7 +2524,7 @@ __metadata:
dependencies:
"@auth0/auth0-vue": "npm:^2.3.3"
"@carto/api-client": "npm:^0.2.1"
"@carto/create-common": "npm:^0.1.2-alpha.0"
"@carto/create-common": "npm:^0.1.2-alpha.7"
"@deck.gl/aggregation-layers": "npm:^9.0.24"
"@deck.gl/carto": "npm:^9.0.24"
"@deck.gl/core": "npm:^9.0.24"
Expand Down