Skip to content

SSR support fixes #4271

SSR support fixes

SSR support fixes #4271

Workflow file for this run

name: Prerelease
on:
push:
branches-ignore:
- "master"
jobs:
build:
name: Build
if: "contains(github.event.head_commit.message, '[prerelease]')"
uses: ./.github/workflows/build-and-upload.yml
secrets:
npm_token: ${{ secrets.npm_token }}
prerelease:
name: Prerelease
needs: build
if: ${{ needs.build.outputs.has_changes == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set variables
run: |
echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Run Setup
uses: ./.github/actions/setup
with:
npm_token: ${{ secrets.npm_token }}
- uses: ./.github/actions/git-creds
- uses: ./.github/actions/download-builds
- name: Generate new versions
id: generate-versions
run: |
commit_sha=$COMMIT_SHA
preid="alpha-${commit_sha:0:5}"
full_output=$(yarn lerna version --exact --conventional-commits --conventional-prerelease --json --no-changelog --no-push --preid "$preid" -y)
# extract only the JSON portion from the full output, excluding yarn logs
json_output=$(echo "$full_output" | awk '/^\[/{p=1} p; /\]/{p=0}' )
echo 'new_versions<<EOF' >> $GITHUB_OUTPUT
echo "$json_output" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- run: yarn config set registry https://registry.npmjs.org/
- name: Setup .npmrc for publish
run: npm set "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
- name: Publish new versions
run: yarn lerna publish from-package --dist-tag prerelease -y
- name: Get current PR id
uses: 8BitJonny/[email protected]
id: PR
- name: Prepare PR comment
id: prepare-comment
env:
json_data: ${{ steps.generate-versions.outputs.new_versions }}
run: |
echo 'comment_body<<EOF' >> $GITHUB_OUTPUT
echo "A new prerelease version of this PR has been published! 🎉" >> $GITHUB_OUTPUT
echo "To install this prerelease version, run the following command in your terminal with any one of the packages changed in this PR:" >> $GITHUB_OUTPUT
echo "$json_data" | jq -r '.[] | "\nTo update `\(.name)`:\n```\nyarn add \(.name)@\(.newVersion)\n```\nOr with npm:\n```\nnpm i \(.name)@\(.newVersion)\n```\n"' >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Create comment with prerelease version details
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.PR.outputs.number }}
body: ${{ steps.prepare-comment.outputs.comment_body }}