8
8
concurrency : ${{ github.workflow }}-${{ github.ref }}
9
9
10
10
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
+
11
29
release :
12
- name : Release
30
+ name : Release (if new version)
13
31
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 }}
14
37
steps :
15
38
- name : Checkout Repo
16
39
uses : actions/checkout@v4
@@ -27,28 +50,32 @@ jobs:
27
50
- name : npm release
28
51
run : |
29
52
$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
30
81
#
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
-
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
0 commit comments