Fix portal #63
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Release | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize, reopened, labeled] | |
jobs: | |
pre-release: | |
if: contains(github.event.pull_request.labels.*.name, 'Automate Pre-Release') | |
name: 🚀 Pre-Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm run build --filter=docs^... | |
- name: Create Pre-Release Version | |
id: changesets | |
run: | | |
pnpm changeset version --snapshot alpha | |
pnpm run publish --tag alpha --no-git-checks | |
echo "::set-output name=published::true" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Get published package version | |
if: steps.changesets.outputs.published == 'true' | |
id: version | |
run: | | |
published_packages="$(node scripts/published-package.js)" | |
formatted_packages=$(echo $published_packages | jq -r '.[] | "\(.name)@\(.version)"') | |
echo "::set-output name=packages::$formatted_packages" | |
- name: Find Comment | |
if: steps.changesets.outputs.published == 'true' | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: New Pre-Release Version | |
- name: Create or update comment | |
if: steps.changesets.outputs.published == 'true' | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
:tada: New Pre-Release Version :tada: | |
${{ steps.version.outputs.packages }} | |
:warning: Please use with caution. All the pre-release packages are only for testing purposes and are not intended to be used in production. | |
edit-mode: replace |