Skip to content

Commit a57e8b2

Browse files
committed
prospector: testing out dogfooding its own versioning tool.
1 parent 6432089 commit a57e8b2

2 files changed

Lines changed: 67 additions & 12 deletions

File tree

.github/workflows/publish.yml

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,69 @@ on:
4343

4444
jobs:
4545
publish:
46-
uses: arcmantle/github-workflows/.github/workflows/pnpm-publish.yml@main
47-
with:
48-
triggered-by: ${{ inputs.triggered-by }}
49-
dep-map: ${{ inputs.dep-map }}
50-
pre-build-script: ${{ inputs.pre-build-script }}
51-
additional-deps: ${{ inputs.additional-deps }}
52-
version-increment: ${{ inputs.version-increment }}
53-
node-version: ${{ inputs.node-version }}
54-
access: ${{ inputs.access }}
55-
secrets:
56-
NPM_PUBLISH: ${{ secrets.NPM_PUBLISH }}
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ inputs.node-version }}
52+
registry-url: https://registry.npmjs.org/
53+
54+
- name: Update dependencies
55+
if: ${{ inputs.dep-map != '{}' }}
56+
uses: arcmantle/github-actions/replace-deps@main
57+
with:
58+
dep-map: ${{ inputs.dep-map }}
59+
60+
- name: Setup pnpm
61+
uses: pnpm/action-setup@v4
62+
with:
63+
version: 10.18
64+
65+
- name: Run pre-build script
66+
if: ${{ inputs.pre-build-script != '' }}
67+
run: ${{ inputs.pre-build-script }}
68+
69+
- name: Install common build dependencies.
70+
run: pnpm add -D rimraf typescript @arcmantle/tsconfig @types/node ${{ inputs.additional-deps }}
71+
72+
- name: Install dependencies.
73+
run: pnpm install
74+
75+
- name: Build project.
76+
run: pnpm build
77+
78+
- name: Calculate version with Prospector
79+
id: version
80+
run: |
81+
echo "🔍 Using Prospector to calculate version..."
82+
VERSION=$(node dist/bin.js)
83+
echo "📦 Calculated version: $VERSION"
84+
echo "version=$VERSION" >> $GITHUB_OUTPUT
85+
86+
PACKAGE_NAME=$(node -p "require('./package.json').name")
87+
echo "package=$PACKAGE_NAME" >> $GITHUB_OUTPUT
88+
89+
- name: Set package version
90+
run: |
91+
echo "✅ Setting package version to ${{ steps.version.outputs.version }}"
92+
npm version ${{ steps.version.outputs.version }} --no-git-tag-version
93+
echo "📦 Package ${{ steps.version.outputs.package }} ready to publish"
94+
95+
#- name: Publish to NPM
96+
# run: pnpm publish --access ${{ inputs.access }} --no-git-checks
97+
# env:
98+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
99+
# NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
100+
101+
#uses: arcmantle/github-workflows/.github/workflows/pnpm-publish.yml@main
102+
#with:
103+
# triggered-by: ${{ inputs.triggered-by }}
104+
# dep-map: ${{ inputs.dep-map }}
105+
# pre-build-script: ${{ inputs.pre-build-script }}
106+
# additional-deps: ${{ inputs.additional-deps }}
107+
# version-increment: ${{ inputs.version-increment }}
108+
# node-version: ${{ inputs.node-version }}
109+
# access: ${{ inputs.access }}
110+
#secrets:
111+
# NPM_PUBLISH: ${{ secrets.NPM_PUBLISH }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"scripts": {
4646
"build": "tsdown",
4747
"dev": "tsc --watch",
48-
"prepublishOnly": "pnpm build && pnpm test run",
48+
"skip_prepublishOnly": "pnpm build && pnpm test run",
4949
"test": "vitest"
5050
},
5151
"dependencies": {

0 commit comments

Comments
 (0)