Skip to content

Commit

Permalink
Dont cut canaries off monorepo branch anylonger
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed Nov 8, 2023
1 parent e62e605 commit b8fe25f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- monorepo
paths-ignore:
- "**/*.md"
pull_request:
Expand Down Expand Up @@ -97,7 +96,7 @@ jobs:
runs-on: ubuntu-latest
name: Publish (NPM)
needs: ['build', 'test']
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/monorepo' || github.event_name == 'release' }}
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
permissions:
id-token: write
steps:
Expand Down
4 changes: 2 additions & 2 deletions publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { execSync } = require("child_process");
const { writeFileSync, readFileSync } = require("fs");
const { join, basename } = require("path");

const [, packageFromRef, versionFromRef] = /^refs\/tags\/(.+)-v(\d\d*\.\d\d*(\.\d\d*)?(-.+)?)$/.exec(process.env.GITHUB_REF ?? "") ?? [];
const [, packageFromRef, versionFromRef,, prerelease] = /^refs\/tags\/(.+)-v(\d\d*\.\d\d*(\.\d\d*)?(-.+)?)$/.exec(process.env.GITHUB_REF ?? "") ?? [];
const ref = process.env.GITHUB_SHA ?? "HEAD";
const shortSHA = execSync(`git rev-parse --short ${ref}`).toString().trim();

Expand All @@ -30,7 +30,7 @@ for (const lerna of lernaList) {
}
const version = versionFromRef || `${lerna.version}-canary.${shortSHA}`;
const cwd = lerna.location;
const tag = versionFromRef ? (version.includes('-') ? 'next' : 'latest') : 'canary';
const tag = versionFromRef ? (prerelease ? 'next' : 'latest') : 'canary';
const packageJsonPath = join(lerna.location, 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
packageJson.version = version;
Expand Down

0 comments on commit b8fe25f

Please sign in to comment.