Skip to content
65 changes: 61 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
- name: Update package version in package.json
run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}

- name: Update manifest.json version
run: jq '.version = "${{ needs.release_metadata.outputs.version_number }}"' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json

- name: Update CHANGELOG.md
uses: DamianReeves/write-file-action@master
with:
Expand All @@ -77,7 +80,7 @@ jobs:
with:
author_name: Apify Release Bot
author_email: noreply@apify.com
message: "chore(release): Update changelog and package version [skip ci]"
message: "chore(release): Update changelog, package.json and manifest.json versions [skip ci]"

create_github_release:
name: Create github release
Expand All @@ -88,7 +91,34 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.update_changelog.changelog_commitish }}
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
- name: Verify commit SHA
run: |
CURRENT_SHA=$(git rev-parse HEAD)
EXPECTED_SHA="${{ needs.update_changelog.outputs.changelog_commitish }}"
echo "Expected commit SHA: $EXPECTED_SHA"
echo "Actual checked out SHA: $CURRENT_SHA"
if [ "$EXPECTED_SHA" != "$CURRENT_SHA" ]; then
echo "ERROR: Checked out SHA differs from expected!"
exit 1
else
echo "✓ Commit SHA matches expected"
fi
- name: Verify manifest.json version
run: |
EXPECTED_VERSION="${{ needs.release_metadata.outputs.version_number }}"
ACTUAL_VERSION=$(jq -r '.version' manifest.json)

echo "Expected version: $EXPECTED_VERSION"
echo "Actual version in manifest.json: $ACTUAL_VERSION"
echo "Current commit SHA: ${{ needs.update_changelog.outputs.changelog_commitish }}"

if [ "$EXPECTED_VERSION" != "$ACTUAL_VERSION" ]; then
echo "ERROR: Version mismatch! Expected $EXPECTED_VERSION but found $ACTUAL_VERSION in manifest.json"
exit 1
fi

echo "✓ Version check passed: manifest.json has correct version $ACTUAL_VERSION"
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -124,12 +154,39 @@ jobs:

publish_to_npm:
name: Publish to NPM
needs: [ update_changelog ]
needs: [ release_metadata, update_changelog ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.update_changelog.changelog_commitish }}
ref: ${{ needs.update_changelog.outputs.changelog_commitish }}
- name: Verify commit SHA
run: |
CURRENT_SHA=$(git rev-parse HEAD)
EXPECTED_SHA="${{ needs.update_changelog.outputs.changelog_commitish }}"
echo "Expected commit SHA: $EXPECTED_SHA"
echo "Actual checked out SHA: $CURRENT_SHA"
if [ "$EXPECTED_SHA" != "$CURRENT_SHA" ]; then
echo "ERROR: Checked out SHA differs from expected!"
exit 1
else
echo "✓ Commit SHA matches expected"
fi
- name: Verify manifest.json version
run: |
EXPECTED_VERSION="${{ needs.release_metadata.outputs.version_number }}"
ACTUAL_VERSION=$(jq -r '.version' manifest.json)

echo "Expected version: $EXPECTED_VERSION"
echo "Actual version in manifest.json: $ACTUAL_VERSION"
echo "Current commit SHA: ${{ needs.update_changelog.outputs.changelog_commitish }}"

if [ "$EXPECTED_VERSION" != "$ACTUAL_VERSION" ]; then
echo "ERROR: Version mismatch! Expected $EXPECTED_VERSION but found $ACTUAL_VERSION in manifest.json"
exit 1
fi

echo "✓ Version check passed: manifest.json has correct version $ACTUAL_VERSION"
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
Expand Down