Skip to content

Commit d582eb8

Browse files
committed
let's do it
1 parent 8272d6d commit d582eb8

File tree

2 files changed

+57
-30
lines changed

2 files changed

+57
-30
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,32 @@ on:
88
concurrency: ${{ github.workflow }}-${{ github.ref }}
99

1010
jobs:
11+
check-package-version:
12+
name: Check package version and detect an update
13+
runs-on: ubuntu-20.04
14+
outputs:
15+
committed-version: ${{ steps.check-package-version.outputs.committed-version }}
16+
published-version: ${{ steps.check-package-version.outputs.published-version }}
17+
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }}
18+
steps:
19+
- name: Checkout the repository
20+
uses: actions/checkout@v4
21+
22+
- name: Check package version and detect an update
23+
id: check-package-version
24+
uses: PostHog/check-package-version@v2
25+
with:
26+
# only supports one path - we'll cross that bridge when we come to it
27+
path: 'packages/rrweb'
28+
1129
release:
12-
name: Release
30+
name: Release (if new version)
1331
runs-on: ubuntu-latest
32+
needs: check-package-version
33+
if: needs.check-package-version.outputs.is-new-version == 'true'
34+
env:
35+
COMMITTED_VERSION: ${{ needs.check-package-version.outputs.committed-version }}
36+
PUBLISHED_VERSION: ${{ needs.check-package-version.outputs.published-version }}
1437
steps:
1538
- name: Checkout Repo
1639
uses: actions/checkout@v4
@@ -27,28 +50,32 @@ jobs:
2750
- name: npm release
2851
run: |
2952
$GITHUB_WORKSPACE/scripts/npm-release.sh
53+
54+
55+
#
56+
# - name: Create GitHub release
57+
# env:
58+
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
# run: |
60+
# # read from the first until the second header in the changelog file
61+
# # this assumes the formatting of the file
62+
# # and that this workflow is always running for the most recent entry in the file
63+
# LAST_CHANGELOG_ENTRY=$(awk -v defText="see CHANGELOG.md" '/^## /{if (flag) exit; flag=1} flag && /^##$/{exit} flag; END{if (!flag) print defText}' CHANGELOG.md)
64+
# # the action we used to use was archived, and made it really difficult to create a release with a body
65+
# # because the LAST_CHANGELOG_ENTRY contains bash special characters so passing it between steps
66+
# # was a pain.
67+
# # we can use the github cli to create a release with a body
68+
# # all as part of one step
69+
# gh api \
70+
# --method POST \
71+
# -H "Accept: application/vnd.github+json" \
72+
# -H "X-GitHub-Api-Version: 2022-11-28" \
73+
# /repos/posthog/posthog-js/releases \
74+
# -f tag_name="v${{ env.COMMITTED_VERSION }}" \
75+
# -f target_commitish='main' \
76+
# -f name="${{ env.COMMITTED_VERSION }}" \
77+
# -f body="$LAST_CHANGELOG_ENTRY" \
78+
# -F draft=false \
79+
# -F prerelease=false \
80+
# -F generate_release_notes=false
3081
#
31-
# - name: Create Release Pull Request or Publish to npm
32-
# id: changesets
33-
# uses: changesets/action@v1
34-
# with:
35-
# publish: yarn run release
36-
# env:
37-
# NODE_OPTIONS: '--max-old-space-size=4096'
38-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40-
41-
# - name: Build Chrome Extension
42-
# if: steps.changesets.outputs.published == 'true'
43-
# run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension
44-
##
45-
# - name: Publish Chrome Extension
46-
# uses: mnao305/[email protected]
47-
# if: steps.changesets.outputs.published == 'true'
48-
# with:
49-
# extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe'
50-
# file-path: ./packages/web-extension/dist/chrome.zip
51-
# client-id: ${{ secrets.CWS_CLIENT_ID }}
52-
# client-secret: ${{ secrets.CWS_CLIENT_SECRET }}
53-
# refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }}
54-
# publish: true

scripts/npm-release.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ yarn run build:all
1616
# first as a dry run to check they should all publish
1717
for PACKAGE in "${PACKAGES[@]}"; do
1818
echo "Publishing $PACKAGE"
19-
npm publish --dry-run --workspace "$PACKAGE" || { echo "Failed to publish $PACKAGE"; exit 1; }
19+
npm publish --dry-run --workspace "$PACKAGE" || { echo "Failed to dry-run publish $PACKAGE"; exit 1; }
2020
done
2121

2222
# then for real
23-
#for PACKAGE in "${PACKAGES[@]}"; do
24-
# echo "Publishing $PACKAGE"
25-
# npm publish --workspace "$PACKAGE" || { echo "Failed to publish $PACKAGE"; exit 1; }
26-
#done
23+
for PACKAGE in "${PACKAGES[@]}"; do
24+
echo "Publishing $PACKAGE"
25+
npm publish --workspace "$PACKAGE" || { echo "Failed to publish $PACKAGE"; exit 1; }
26+
done

0 commit comments

Comments
 (0)