Skip to content

Commit

Permalink
Add PR numbers to changelogs (#68)
Browse files Browse the repository at this point in the history
* Add PR numbers to changelogs

* remove output

* remove pnpm

* fix typo

* update docs publish

* fix syntax
  • Loading branch information
pilcrowonpaper authored Jan 31, 2024
1 parent c3d0e6d commit adefc66
Show file tree
Hide file tree
Showing 10 changed files with 258 additions and 100 deletions.
1 change: 1 addition & 0 deletions .changesets/css5q.patch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add PR numbers to changelogs
12 changes: 5 additions & 7 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
outputs:
- auri_publish_result: ${{ steps.auri-publish.outputs.test }}
steps:
- name: Setup actions
uses: actions/checkout@v3
Expand All @@ -20,12 +18,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Auri
run: npm i -g auri
- name: Install dependencies
run: npm i && npm run build
- name: Prepare release
run: pnpm auri prepare ${{ github.ref_name }}
run: npm run auri prepare ${{ github.ref_name }}
- name: Publish package
run: pnpm auri publish
run: npm run auri publish
- name: Check if ".changesets" directory has files
id: check-changesets
run: |
Expand All @@ -35,5 +33,5 @@ jobs:
echo "changesets=1" >> "$GITHUB_OUTPUT"
fi
- name: Publish docs
if: steps.check-changesets.outputs.changesets == 0
if: steps.check-changesets.outputs.changesets == 0 && github.ref_name == 'main'
run: echo "Publish!"
20 changes: 9 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { publish } from "./scripts/publish.js";
// import { listPackages } from "./scripts/list.js";
// import { addReleaseConfig } from "./scripts/release-config.js";
import { prepareRelease } from "./scripts/prepare.js";
import { addChangeset } from "./scripts/add.js";

const nodeArgs = process.execArgv;
const args = process.argv.slice(nodeArgs.length + 2);

const kill = () => process.exit();
process.on("uncaughtException", (e) => {
// show error in GitHub actions
process.stderr.write(`::error ::${e.message}`);
process.exit();
});

if (!args[0]) kill();

const baseArg = args[0];

if (baseArg === "add") {
if (args[0] === "add") {
const type = args.at(1) ?? null;
if (type === null) {
throw new Error("Missing arguments");
Expand All @@ -24,16 +22,16 @@ if (baseArg === "add") {
await addChangeset(type);
}

if (baseArg === "prepare") {
if (args[0] === "prepare") {
const branch = args.at(1) ?? null;
if (branch === null) {
throw new Error("Missing arguments");
}
await prepareRelease(branch);
}

if (baseArg === "publish") {
if (args[0] === "publish") {
await publish();
}

kill();
process.exit();
Loading

0 comments on commit adefc66

Please sign in to comment.