Skip to content

fix(rrweb-snapshot): inserting doctype element #84

fix(rrweb-snapshot): inserting doctype element

fix(rrweb-snapshot): inserting doctype element #84

name: Autobump
on:
pull_request:
types: [closed]
jobs:
label-version-bump:
name: Bump version based on PR label
runs-on: ubuntu-22.04
if: |
github.event.pull_request.merged
&& (
contains(github.event.pull_request.labels.*.name, 'bump patch')
|| contains(github.event.pull_request.labels.*.name, 'bump minor')
|| contains(github.event.pull_request.labels.*.name, 'bump major')
)
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js lts/*
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
- name: Detect version bump type
id: bump-type
run: |
BUMP_TYPE=null
if [[ $BUMP_PATCH_PRESENT == 'true' ]]; then
BUMP_TYPE=patch
fi
if [[ $BUMP_MINOR_PRESENT == 'true' ]]; then
BUMP_TYPE=minor
fi
if [[ $BUMP_MAJOR_PRESENT == 'true' ]]; then
BUMP_TYPE=major
fi
echo "bump-type=$BUMP_TYPE" >> "$GITHUB_OUTPUT"
env:
BUMP_PATCH_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump patch') }}
BUMP_MINOR_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump minor') }}
BUMP_MAJOR_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump major') }}
- name: Update version in package.json for packages we import in posthog
if: steps.bump-type.outputs.bump-type != 'null'
env:
BUMP_TYPE: ${{ steps.bump-type.outputs.bump-type }}
id: version-update
run: |
OUTPUT=$($GITHUB_WORKSPACE/scripts/version-packages.sh | tail -n1)
echo "OLD_VERSION=$(echo -n "$OUTPUT" | jq -r '.old_version')" >> "$GITHUB_ENV"
echo "NEW_VERSION=$(echo -n "$OUTPUT" | jq -r '.new_version')" >> "$GITHUB_ENV"
- name: Update the lockfile
run: yarn install
- name: Update CHANGELOG.md
run: |
set -e
# Check if tag exists for old version
if git tag -l | grep -q "^$OLD_VERSION$"; then
echo "Found tag for old version: $OLD_VERSION"
# Get commit titles between old version tag and HEAD
COMMIT_MESSAGES=$(git log --oneline --pretty=format:" - %s" $OLD_VERSION..HEAD)
else
echo "No tag found for old version: $OLD_VERSION"
# Fall back to simple message
COMMIT_MESSAGES=" - Bump version to $NEW_VERSION"
fi
CHANGELOG_HEADING="## $NEW_VERSION - $(date --iso-8601)"
mv CHANGELOG.md CHANGELOG.old.md
echo -e "$CHANGELOG_HEADING\n\n$COMMIT_MESSAGES\n\n$(cat CHANGELOG.old.md)" > CHANGELOG.md
rm CHANGELOG.old.md
yarn run format:head
env:
OLD_VERSION: ${{ env.OLD_VERSION }}
NEW_VERSION: ${{ env.NEW_VERSION }}
# then commit back to main,
# needs to be able to bypass the branch protection
- name: Commit bump
if: steps.bump-type.outputs.bump-type != 'null'
uses: EndBug/add-and-commit@v9
with:
message: "chore: Bump version to ${{ env.NEW_VERSION }}"
github_token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
commit: --no-verify
push: --no-verify
tag: ${{ env.NEW_VERSION }}
tag_push: --no-verify
env:
NEW_VERSION: ${{ env.NEW_VERSION }}