Skip to content

feat: add ability to pre publish canary versions #4

feat: add ability to pre publish canary versions

feat: add ability to pre publish canary versions #4

Workflow file for this run

name: Pull Request
on:
pull_request:
paths-ignore:
- '.changeset/**'
- '.husky/**'
- '.github/**'
concurrency:
group: ci-pull-request=${{github.ref}}-1
cancel-in-progress: true
permissions:
contents: read # Read-only access to repository contents
issues: write # Write access to issues
pull-requests: write # Write access to pull requests
statuses: write # Write access to commit statuses
jobs:
build:
name: 'Build & canary release'
runs-on: ubuntu-latest
strategy:
matrix:
pkg:
- cli
- core
- html
- parser
- plugin-helper
- preset
- preset-html5
- preset-react
- preset-vue
- react
- types
- vue2
- vue3
env:
NODE_OPTIONS: --max-old-space-size=4096
environment:
name: Alpha package in NPM
url: https://www.npmjs.com/package/@bbob/${{ matrix.pkg }}/v/${{ steps.publish.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install
run: pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Set env
run: echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: Increment alpha
run: pnpm version 0.0.0-alpha.$SHORT_SHA --no-git-tag-version --workspace bbob-${{ matrix.pkg }}
- name: Build project
run: pnpm build
- name: Publish alpha
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
tag: pr_${{ github.event.number }}
access: public
check-version: true
package: ./packages/bbob-${{ matrix.pkg }}/package.json
- name: Comment PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const setMessage = require('${{ github.workspace }}/scripts/ci/set-message')
await setMessage({
header: `## @bbob/${{ matrix.pkg }} NPM alpha release`,
body: 'Deployed @bbob/${{ matrix.pkg }} [${{ steps.publish.outputs.version }}](https://www.npmjs.com/package/@bbob/${{ matrix.pkg }}/v/${{ steps.publish.outputs.version }}).',
github,
repo: context.repo,
prNumber: context.payload.pull_request.number
})