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

Replace nightly with canary releases #9559

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This workflow builds and releases all packages on the main branch with a canary
# dist tag. These packages contain changes that are not yet available in a publicly
# released version of Parcel.
name: canary-release

on:
push:
branches:
- v2
workflow_dispatch:

jobs:
build-and-release:
name: Build and release canary
uses: ./.github/workflows/release.yml
secrets: inherit
with:
release-command: |
yarn canary:release --summary-file
node scripts/tag-release.mjs --tag nightly
218 changes: 0 additions & 218 deletions .github/workflows/nightly-release.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"test:integration-ci": "yarn workspace @parcel/integration-tests test-ci",
"test": "yarn test:unit && yarn test:integration",
"dev:release": "lerna publish -y --canary --preid dev --dist-tag=dev --exact --force-publish=* --no-git-tag-version --no-push",
"nightly:release": "lerna publish -y --canary --preid nightly --dist-tag=nightly --exact --force-publish=* --no-git-tag-version --no-push",
"canary:release": "lerna publish -y --canary --preid canary --dist-tag=canary --exact --force-publish=* --no-git-tag-version --no-push",
"tag:prerelease": "lerna version --exact --force-publish=* --no-git-tag-version --no-push && yarn adjust-versions --exact",
"tag:release": "lerna version --exact --force-publish=* --no-git-tag-version --no-push && yarn adjust-versions",
"adjust-versions": "node scripts/update-config-dependencies.js && node scripts/update-engines-peerdeps.js",
Expand All @@ -53,7 +53,7 @@
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"husky": "^6.0.0",
"lerna": "^3.22.1",
"lerna": "^6.6.2",
"lint-staged": "^10.2.11",
"mocha": "^8.3.0",
"mocha-junit-reporter": "^2.0.0",
Expand Down
38 changes: 38 additions & 0 deletions scripts/tag-release.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* eslint-disable no-console */

import {execSync} from 'node:child_process';
import {readFile} from 'node:fs/promises';
import {URL} from 'node:url';

import program from 'commander';

async function main(tag) {
let publishSummary = JSON.parse(
await readFile(
new URL('../lerna-publish-summary.json', import.meta.url).pathname,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen this kind of pattern of using an URL in a readFile, what does it do over a readFile(path.resolve(__dirname, "../lerna-publish-summary.json"))?

Copy link
Contributor Author

@MonicaOlejniczak MonicaOlejniczak Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither, only just used it for the first time. It's the equivalent to your example in esm land, and will be an absolute path due to accessing pathname

Example: /parcel/lerna-publish-summary.json

'utf8',
),
);

for (let {packageName, version} of publishSummary) {
execSync(`npm dist-tag add ${packageName}@${version} ${tag}`, {
encoding: 'utf8',
});
}
}

let {tag} = program
// TODO Use requiredOption once commander is upgraded in the root
.option(
'--tag <tag>',
'The npm tag to add to every package published in the latest release',
)
.parse(process.argv);

if (!tag) {
throw new Error('Required option `tag` not specified');
}

main(tag).then(() => {
console.log(`Successfully added @${tag} to released packages`);
});
Loading
Loading