Skip to content

Commit a4eae34

Browse files
authoredJul 29, 2021
fix: linking CLI version output with package.json (#6097)
* fix: Importing package.json `version` via script during `changeset version` so that the value doesn't need to be updated separately from release automation. Updating auto-publish values + changeset generation to be more frictionless
1 parent b9b275f commit a4eae34

File tree

9 files changed

+77
-40
lines changed

9 files changed

+77
-40
lines changed
 

Diff for: ‎.changeset/config.json

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
33
"changelog": "@changesets/changelog-git",
4-
"commit": true,
5-
"linked": [],
6-
"access": "restricted",
4+
"commit": false,
5+
"linked": [[
6+
"app-builder-lib",
7+
"builder-util",
8+
"dmg-builder",
9+
"electron-builder",
10+
"electron-builder-squirrel-windows",
11+
"electron-forge-maker-appimage",
12+
"electron-forge-maker-nsis",
13+
"electron-forge-maker-nsis-web",
14+
"electron-forge-maker-snap",
15+
"electron-publish"
16+
]],
17+
"access": "public",
718
"baseBranch": "master",
819
"updateInternalDependencies": "patch",
920
"ignore": ["@electron-builder/test"]

Diff for: ‎.changeset/fast-peaches-play.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"app-builder-lib": patch
3+
"builder-util": patch
4+
"builder-util-runtime": patch
5+
"dmg-builder": patch
6+
"electron-builder": patch
7+
"electron-builder-squirrel-windows": patch
8+
"electron-forge-maker-appimage": patch
9+
"electron-forge-maker-nsis": patch
10+
"electron-forge-maker-nsis-web": patch
11+
"electron-forge-maker-snap": patch
12+
"electron-publish": patch
13+
"electron-updater": patch
14+
---
15+
16+
Synchronizing CLI and package.json versions. Updating auto-publish values + changeset generation to be more frictionless

Diff for: ‎.github/renovate.json5

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"npm:unpublishSafe",
1919
"helpers:disableTypesNodeMajor"
2020
],
21-
"schedule": ["every weekend"],
21+
"schedule": ["before 3am on the first day of the month"],
2222
"packageRules": [
2323
{
2424
"groupName": "ESLint and Prettier",
@@ -29,9 +29,7 @@
2929
},
3030
"circleci": {
3131
"enabled": true,
32-
// "automerge": true,
33-
// "automergeType": "branch",
34-
"schedule": ["before 9am on Friday"],
32+
"schedule": ["before 3am on the first day of the month"],
3533
"pinDigests": true,
3634
"semanticCommitScope": "docker",
3735
"semanticCommitType": "ci",

Diff for: ‎.github/workflows/pr-release.yml

+29-12
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,44 @@ jobs:
1818
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1919
fetch-depth: 0
2020

21-
- name: setup node.js
22-
uses: actions/setup-node@v2
21+
- uses: pnpm/action-setup@v2
2322
with:
24-
node-version: 14
23+
version: 6.10.0
2524

26-
- name: install pnpm
27-
run: npm i pnpm@latest -g
25+
- uses: actions/setup-node@v2
26+
with:
27+
node-version: '14'
28+
cache: 'pnpm'
29+
30+
- name: Set up NPM credentials
31+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
32+
env:
33+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2834

2935
- name: setup pnpm config
3036
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
3137

32-
- name: install dependencies
33-
run: pnpm install
34-
35-
- name: create versions PR & prepare publish
38+
- run: pnpm install
39+
40+
- name: Create versions PR & prepare publish
41+
id: changesets
3642
uses: changesets/action@master
3743
with:
3844
version: pnpm ci:version
39-
commit: 'chore(deploy): Bump versions'
40-
title: 'chore(deploy): Bump versions'
45+
commit: 'chore(deploy): Release'
46+
title: 'chore(deploy): Release'
4147
publish: pnpm ci:publish
4248
env:
4349
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
52+
- name: Send a stream message
53+
uses: zulip/github-actions-zulip/send-message@v1
54+
if: steps.changesets.outputs.published == 'true'
55+
with:
56+
api-key: ${{ secrets.ZULIP_API_KEY }}
57+
email: ${{ secrets.ZULIP_EMAIL }}
58+
organization-url: 'https://electron-builder.zulipchat.com'
59+
to: 'releases'
60+
type: 'stream'
61+
content: ${{ steps.changesets.outputs.publishedPackages }}

Diff for: ‎package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
"test-update": "UPDATE_SNAPSHOT=true pnpm test-all",
2323
"docker-images": "docker/build.sh",
2424
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
25-
"ci:version": "pnpm changelog && changeset version",
26-
"ci:publish": "pnpm compile && pnpm publish -r --filter ./packages --tag next",
25+
"generate-changeset": "pnpm changeset",
26+
"ci:version": "pnpm changelog && changeset version && node scripts/update-package-version-export.js && git add .",
27+
"ci:publish": "pnpm compile && changeset publish",
2728
"schema": "typescript-json-schema packages/app-builder-lib/tsconfig.json Configuration --out packages/app-builder-lib/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --required && node ./scripts/fix-schema.js",
2829
"jsdoc": "ts2jsdoc packages/builder-util-runtime packages/builder-util packages/app-builder-lib packages/electron-builder packages/electron-publish",
2930
"jsdoc2md": "node scripts/jsdoc2md.js",
@@ -64,5 +65,9 @@
6465
"typescript": "4.3.5",
6566
"typescript-json-schema": "0.50.1",
6667
"v8-compile-cache": "2.3.0"
68+
},
69+
"engines": {
70+
"node": ">=14",
71+
"pnpm": ">=6"
6772
}
6873
}

Diff for: ‎packages/app-builder-lib/src/version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const PACKAGE_VERSION = "22.11.8"
1+
export const PACKAGE_VERSION = "22.11.10"

Diff for: ‎scripts/babel-plugin-version-transform.js

-18
This file was deleted.

Diff for: ‎scripts/update-package-version-export.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require("path")
2+
const version = require(path.join(__dirname, "../packages/app-builder-lib/package.json")).version
3+
4+
const destFile = path.join(__dirname, '../packages/app-builder-lib/src/version.ts')
5+
6+
const { writeFileSync } = require("fs")
7+
writeFileSync(destFile, `export const PACKAGE_VERSION = "${version}"`)

Diff for: ‎test/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@electron-builder/test",
3+
"version": "0.0.0",
34
"private": true,
45
"dependencies": {
56
"7zip-bin": "~5.1.1",

0 commit comments

Comments
 (0)
Please sign in to comment.