Skip to content

Commit 89d198e

Browse files
committed
add version checks also to the npm publish job
1 parent 98a193d commit 89d198e

File tree

1 file changed

+53
-33
lines changed

1 file changed

+53
-33
lines changed

.github/workflows/release.yaml

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,18 @@ jobs:
8989
env:
9090
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9191
steps:
92-
- name: Validate commit SHA
93-
run: |
94-
COMMIT_SHA="${{ needs.update_changelog.outputs.changelog_commitish }}"
95-
if [ -z "$COMMIT_SHA" ]; then
96-
echo "ERROR: changelog_commitish is empty!"
97-
exit 1
98-
fi
99-
echo "Using commit SHA: $COMMIT_SHA"
10092
- uses: actions/checkout@v4
10193
with:
10294
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
103-
- name: Log current commit SHA
95+
- name: Verify commit SHA
10496
run: |
10597
CURRENT_SHA=$(git rev-parse HEAD)
10698
EXPECTED_SHA="${{ needs.update_changelog.outputs.changelog_commitish }}"
10799
echo "Expected commit SHA: $EXPECTED_SHA"
108100
echo "Actual checked out SHA: $CURRENT_SHA"
109101
if [ "$EXPECTED_SHA" != "$CURRENT_SHA" ]; then
110-
echo "WARNING: Checked out SHA differs from expected!"
102+
echo "ERROR: Checked out SHA differs from expected!"
103+
exit 1
111104
else
112105
echo "✓ Commit SHA matches expected"
113106
fi
@@ -159,29 +152,56 @@ jobs:
159152
files: |
160153
actors-mcp-server.dxt
161154
162-
#publish_to_npm:
163-
# name: Publish to NPM
164-
# needs: [ update_changelog ]
165-
# runs-on: ubuntu-latest
166-
# steps:
167-
# - uses: actions/checkout@v4
168-
# with:
169-
# ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
170-
# - name: Use Node.js 22
171-
# uses: actions/setup-node@v4
172-
# with:
173-
# node-version: 22
174-
# cache: 'npm'
175-
# cache-dependency-path: 'package-lock.json'
176-
# - name: Install dependencies
177-
# run: |
178-
# echo "access=public" >> .npmrc
179-
# echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
180-
# npm ci
181-
# - name: Build module
182-
# run: npm run build
183-
# - name: Publish to NPM
184-
# run: npm publish --tag latest
155+
publish_to_npm:
156+
name: Publish to NPM
157+
needs: [ release_metadata, update_changelog ]
158+
runs-on: ubuntu-latest
159+
steps:
160+
- uses: actions/checkout@v4
161+
with:
162+
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
163+
- name: Verify commit SHA
164+
run: |
165+
CURRENT_SHA=$(git rev-parse HEAD)
166+
EXPECTED_SHA="${{ needs.update_changelog.outputs.changelog_commitish }}"
167+
echo "Expected commit SHA: $EXPECTED_SHA"
168+
echo "Actual checked out SHA: $CURRENT_SHA"
169+
if [ "$EXPECTED_SHA" != "$CURRENT_SHA" ]; then
170+
echo "ERROR: Checked out SHA differs from expected!"
171+
exit 1
172+
else
173+
echo "✓ Commit SHA matches expected"
174+
fi
175+
- name: Verify manifest.json version
176+
run: |
177+
EXPECTED_VERSION="${{ needs.release_metadata.outputs.version_number }}"
178+
ACTUAL_VERSION=$(jq -r '.version' manifest.json)
179+
180+
echo "Expected version: $EXPECTED_VERSION"
181+
echo "Actual version in manifest.json: $ACTUAL_VERSION"
182+
echo "Current commit SHA: ${{ needs.update_changelog.outputs.changelog_commitish }}"
183+
184+
if [ "$EXPECTED_VERSION" != "$ACTUAL_VERSION" ]; then
185+
echo "ERROR: Version mismatch! Expected $EXPECTED_VERSION but found $ACTUAL_VERSION in manifest.json"
186+
exit 1
187+
fi
188+
189+
echo "✓ Version check passed: manifest.json has correct version $ACTUAL_VERSION"
190+
- name: Use Node.js 22
191+
uses: actions/setup-node@v4
192+
with:
193+
node-version: 22
194+
cache: 'npm'
195+
cache-dependency-path: 'package-lock.json'
196+
- name: Install dependencies
197+
run: |
198+
echo "access=public" >> .npmrc
199+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
200+
npm ci
201+
- name: Build module
202+
run: npm run build
203+
- name: Publish to NPM
204+
run: npm publish --tag latest
185205

186206
env:
187207
NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}

0 commit comments

Comments
 (0)