Skip to content

Commit

Permalink
fix: linking CLI version output with package.json (#6097)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mmaietta committed Jul 29, 2021
1 parent b9b275f commit a4eae34
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 40 deletions.
17 changes: 14 additions & 3 deletions .changeset/config.json
@@ -1,9 +1,20 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
"changelog": "@changesets/changelog-git",
"commit": true,
"linked": [],
"access": "restricted",
"commit": false,
"linked": [[
"app-builder-lib",
"builder-util",
"dmg-builder",
"electron-builder",
"electron-builder-squirrel-windows",
"electron-forge-maker-appimage",
"electron-forge-maker-nsis",
"electron-forge-maker-nsis-web",
"electron-forge-maker-snap",
"electron-publish"
]],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": ["@electron-builder/test"]
Expand Down
16 changes: 16 additions & 0 deletions .changeset/fast-peaches-play.md
@@ -0,0 +1,16 @@
---
"app-builder-lib": patch
"builder-util": patch
"builder-util-runtime": patch
"dmg-builder": patch
"electron-builder": patch
"electron-builder-squirrel-windows": patch
"electron-forge-maker-appimage": patch
"electron-forge-maker-nsis": patch
"electron-forge-maker-nsis-web": patch
"electron-forge-maker-snap": patch
"electron-publish": patch
"electron-updater": patch
---

Synchronizing CLI and package.json versions. Updating auto-publish values + changeset generation to be more frictionless
6 changes: 2 additions & 4 deletions .github/renovate.json5
Expand Up @@ -18,7 +18,7 @@
"npm:unpublishSafe",
"helpers:disableTypesNodeMajor"
],
"schedule": ["every weekend"],
"schedule": ["before 3am on the first day of the month"],
"packageRules": [
{
"groupName": "ESLint and Prettier",
Expand All @@ -29,9 +29,7 @@
},
"circleci": {
"enabled": true,
// "automerge": true,
// "automergeType": "branch",
"schedule": ["before 9am on Friday"],
"schedule": ["before 3am on the first day of the month"],
"pinDigests": true,
"semanticCommitScope": "docker",
"semanticCommitType": "ci",
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/pr-release.yml
Expand Up @@ -18,27 +18,44 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: setup node.js
uses: actions/setup-node@v2
- uses: pnpm/action-setup@v2
with:
node-version: 14
version: 6.10.0

- name: install pnpm
run: npm i pnpm@latest -g
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'pnpm'

- name: Set up NPM credentials
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

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

- name: install dependencies
run: pnpm install
- name: create versions PR & prepare publish
- run: pnpm install

- name: Create versions PR & prepare publish
id: changesets
uses: changesets/action@master
with:
version: pnpm ci:version
commit: 'chore(deploy): Bump versions'
title: 'chore(deploy): Bump versions'
commit: 'chore(deploy): Release'
title: 'chore(deploy): Release'
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Send a stream message
uses: zulip/github-actions-zulip/send-message@v1
if: steps.changesets.outputs.published == 'true'
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: ${{ secrets.ZULIP_EMAIL }}
organization-url: 'https://electron-builder.zulipchat.com'
to: 'releases'
type: 'stream'
content: ${{ steps.changesets.outputs.publishedPackages }}
9 changes: 7 additions & 2 deletions package.json
Expand Up @@ -22,8 +22,9 @@
"test-update": "UPDATE_SNAPSHOT=true pnpm test-all",
"docker-images": "docker/build.sh",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
"ci:version": "pnpm changelog && changeset version",
"ci:publish": "pnpm compile && pnpm publish -r --filter ./packages --tag next",
"generate-changeset": "pnpm changeset",
"ci:version": "pnpm changelog && changeset version && node scripts/update-package-version-export.js && git add .",
"ci:publish": "pnpm compile && changeset publish",
"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",
"jsdoc": "ts2jsdoc packages/builder-util-runtime packages/builder-util packages/app-builder-lib packages/electron-builder packages/electron-publish",
"jsdoc2md": "node scripts/jsdoc2md.js",
Expand Down Expand Up @@ -64,5 +65,9 @@
"typescript": "4.3.5",
"typescript-json-schema": "0.50.1",
"v8-compile-cache": "2.3.0"
},
"engines": {
"node": ">=14",
"pnpm": ">=6"
}
}
2 changes: 1 addition & 1 deletion packages/app-builder-lib/src/version.ts
@@ -1 +1 @@
export const PACKAGE_VERSION = "22.11.8"
export const PACKAGE_VERSION = "22.11.10"
18 changes: 0 additions & 18 deletions scripts/babel-plugin-version-transform.js

This file was deleted.

7 changes: 7 additions & 0 deletions scripts/update-package-version-export.js
@@ -0,0 +1,7 @@
const path = require("path")
const version = require(path.join(__dirname, "../packages/app-builder-lib/package.json")).version

const destFile = path.join(__dirname, '../packages/app-builder-lib/src/version.ts')

const { writeFileSync } = require("fs")
writeFileSync(destFile, `export const PACKAGE_VERSION = "${version}"`)
1 change: 1 addition & 0 deletions test/package.json
@@ -1,5 +1,6 @@
{
"name": "@electron-builder/test",
"version": "0.0.0",
"private": true,
"dependencies": {
"7zip-bin": "~5.1.1",
Expand Down

0 comments on commit a4eae34

Please sign in to comment.