Skip to content

Commit

Permalink
let's do it
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Jan 31, 2025
1 parent 8272d6d commit d582eb8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 30 deletions.
77 changes: 52 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,32 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
check-package-version:
name: Check package version and detect an update
runs-on: ubuntu-20.04
outputs:
committed-version: ${{ steps.check-package-version.outputs.committed-version }}
published-version: ${{ steps.check-package-version.outputs.published-version }}
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Check package version and detect an update
id: check-package-version
uses: PostHog/check-package-version@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Release' step
Uses Step: check-package-version
uses 'PostHog/check-package-version' with ref 'v2', not a pinned commit hash
with:
# only supports one path - we'll cross that bridge when we come to it
path: 'packages/rrweb'

release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
name: Release
name: Release (if new version)
runs-on: ubuntu-latest
needs: check-package-version
if: needs.check-package-version.outputs.is-new-version == 'true'
env:
COMMITTED_VERSION: ${{ needs.check-package-version.outputs.committed-version }}
PUBLISHED_VERSION: ${{ needs.check-package-version.outputs.published-version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand All @@ -27,28 +50,32 @@ jobs:
- name: npm release
run: |
$GITHUB_WORKSPACE/scripts/npm-release.sh
#
# - name: Create GitHub release
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# # read from the first until the second header in the changelog file
# # this assumes the formatting of the file
# # and that this workflow is always running for the most recent entry in the file
# LAST_CHANGELOG_ENTRY=$(awk -v defText="see CHANGELOG.md" '/^## /{if (flag) exit; flag=1} flag && /^##$/{exit} flag; END{if (!flag) print defText}' CHANGELOG.md)
# # the action we used to use was archived, and made it really difficult to create a release with a body
# # because the LAST_CHANGELOG_ENTRY contains bash special characters so passing it between steps
# # was a pain.
# # we can use the github cli to create a release with a body
# # all as part of one step
# gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/posthog/posthog-js/releases \
# -f tag_name="v${{ env.COMMITTED_VERSION }}" \
# -f target_commitish='main' \
# -f name="${{ env.COMMITTED_VERSION }}" \
# -f body="$LAST_CHANGELOG_ENTRY" \
# -F draft=false \
# -F prerelease=false \
# -F generate_release_notes=false
#

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
# - name: Create Release Pull Request or Publish to npm
# id: changesets
# uses: changesets/action@v1
# with:
# publish: yarn run release
# env:
# NODE_OPTIONS: '--max-old-space-size=4096'
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Build Chrome Extension
# if: steps.changesets.outputs.published == 'true'
# run: NODE_OPTIONS='--max-old-space-size=4096' DISABLE_WORKER_INLINING=true yarn turbo run prepublish --filter=@rrweb/web-extension
##
# - name: Publish Chrome Extension
# uses: mnao305/[email protected]
# if: steps.changesets.outputs.published == 'true'
# with:
# extension-id: 'pdaldeopoccdhlkabbkcjmecmmoninhe'
# file-path: ./packages/web-extension/dist/chrome.zip
# client-id: ${{ secrets.CWS_CLIENT_ID }}
# client-secret: ${{ secrets.CWS_CLIENT_SECRET }}
# refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }}
# publish: true
10 changes: 5 additions & 5 deletions scripts/npm-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ yarn run build:all
# first as a dry run to check they should all publish
for PACKAGE in "${PACKAGES[@]}"; do
echo "Publishing $PACKAGE"
npm publish --dry-run --workspace "$PACKAGE" || { echo "Failed to publish $PACKAGE"; exit 1; }
npm publish --dry-run --workspace "$PACKAGE" || { echo "Failed to dry-run publish $PACKAGE"; exit 1; }
done

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

0 comments on commit d582eb8

Please sign in to comment.