Skip to content

fix: record package bundling (#55) #47

fix: record package bundling (#55)

fix: record package bundling (#55) #47

Workflow file for this run

name: Release
on:
push:
branches:
main
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
with:
# only supports one path - we'll cross that bridge when we come to it
path: 'packages/rrweb'
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
- name: Setup Node.js lts/*
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
registry-url: https://registry.npmjs.org
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: npm release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
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
#