-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: combine publish workflows into single workflow, check packages…
… in order
- Loading branch information
1 parent
94163a0
commit f303c0b
Showing
7 changed files
with
115 additions
and
211 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { execSync } from "node:child_process"; | ||
import { existsSync, readFileSync } from "node:fs"; | ||
import { resolve } from "node:path"; | ||
import { getChangedPackages, getDevVersion } from "./util.mjs"; | ||
|
||
const nightly = process.argv.length > 2 && process.argv[2] === "true"; | ||
const tag = nightly ? "next" : "latest"; | ||
for (const pkg of getChangedPackages(nightly)) { | ||
const packagePath = resolve(pkg, "package.json"); | ||
if (!existsSync(packagePath)) { | ||
console.error(`Could not find package.json at ${packagePath}`); | ||
process.exit(1); | ||
} | ||
|
||
const packageJson = JSON.parse(readFileSync(packagePath, "utf8")); | ||
const pkgName = packageJson.name; | ||
|
||
if (nightly) { | ||
const version = getDevVersion(packageJson.version); | ||
execSync(`yarn workspace ${pkgName} version ${version}`); | ||
console.log(`Set ${pkgName} version to ${version}`); | ||
} | ||
|
||
execSync(`yarn workspace ${pkgName} npm publish --tag ${tag}`); | ||
console.log(`Published ${pkgName}@${tag} to npm`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish packages | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 7 * * *" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- packages/core/package.json | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
nightly: ${{steps.nightly.outputs.nightly }} | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
registry-url: "https://registry.npmjs.org" | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Check nightly status | ||
id: nightly | ||
run: echo "nightly=${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Publish changed packages | ||
run: node .github/scripts/publish.mjs ${{ steps.nightly.outputs.nightly }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.