-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3483b9a
commit bfde2d7
Showing
6 changed files
with
108 additions
and
8 deletions.
There are no files selected for viewing
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,40 @@ | ||
# thanks to https://github.com/systeminit/si/blob/main/.github/workflows/community-check.yml | ||
|
||
name: Label community PR | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
check-is-community: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
env: | ||
DMNO_STAFF: "theoephraim philmillman" | ||
steps: | ||
- name: Check PR author | ||
id: check_author | ||
run: | | ||
PR_AUTHOR="${{ github.event.pull_request.user.login }}" | ||
if ! [[ "${DMNO_STAFF}" =~ "$PR_AUTHOR" ]]; then | ||
echo "Authored by DMNO community member!" | ||
echo "requires-community-tag=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Authored by DMNO staff" | ||
fi | ||
- name: Label PR | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
await github.rest.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: ${{ github.event.pull_request.number }}, | ||
labels: [ steps.check_author.outputs.requires-community-tag && 'community' && 'staff' ] | ||
}); |
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,25 @@ | ||
name: Publish Any Commit | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Enable Corepack | ||
run: corepack enable | ||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
cache: 'pnpm' | ||
- name: Install node deps | ||
run: pnpm i | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
# we use a custom script to run `npx pkg-pr-new publish` | ||
# so that we can determine which packages to release | ||
- run: node scripts/release-preview.js |
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
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,32 @@ | ||
import { execSync } from 'node:child_process'; | ||
import fs from 'node:fs'; | ||
|
||
let err; | ||
try { | ||
// pnpm m ls --json --depth=-1 | node -e "const path = require('path'); console.log(JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf-8')).map((m) => path.relative(__dirname, m.path)).filter(Boolean))" | ||
const workspacePackagesInfoRaw = execSync('pnpm m ls --json --depth=-1'); | ||
const workspacePackagesInfo = JSON.parse(workspacePackagesInfoRaw); | ||
// console.log(workspacePackagesInfo); | ||
|
||
// generate sumamry of changed (publishable) modules according to changesets | ||
// only has option to output to a file | ||
execSync('pnpm exec changeset status --output=changesets-summary.json'); | ||
|
||
const changeSetsSummaryRaw = fs.readFileSync('./changesets-summary.json', 'utf8'); | ||
const changeSetsSummary = JSON.parse(changeSetsSummaryRaw); | ||
// console.log(changeSetsSummary); | ||
|
||
const releasePackagePaths = changeSetsSummary.releases | ||
.filter((r) => r.newVersion !== r.oldVersion) | ||
.map((r) => workspacePackagesInfo.find((p) => p.name === r.name)) | ||
.map((p) => p.path); | ||
// console.log(releasePackagePaths); | ||
|
||
execSync(`pnpm dlx pkg-pr-new publish --compact ${releasePackagePaths.join(' ')}`); | ||
} catch (_err) { | ||
err = _err; | ||
console.error('preview release failed'); | ||
console.error(_err); | ||
} | ||
fs.unlinkSync('./changesets-summary.json'); | ||
process.exit(err ? 1 : 0); |