2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-05 16:42:27 +03:00

feat: add ability to publish pre alpha versions in PR #234 (#235)

* feat: add ability to prepublish canary versions

* fix: ci

* fix: pr comment

* fix: ci pr

* fix: ci pr env

* fix: github env name

* fix: github file ignoring

* fix: yml syntax

* fix: codeql

* fix: syntax error

* fix: pnpm version

* fix: remove node 16.x support

* fix: workspace name

* fix: workspace pnpm

* fix: workspace with pnpm

* ci: changeset publish

* ci: changeset pr name

* ci: pr

* ci: fix pr.yml

* ci: fix pr.yml workspaces

* ci: fix steps order in pr.yml

* ci: fix pr publish error

* ci: fix npm publish tag to alpha

* ci: npm publish tag

* ci: npm publish tag

* ci: fix tag with PR number
This commit is contained in:
Nikolay Kost
2024-06-25 22:27:42 +03:00
committed by GitHub
parent c1275138e5
commit f87822f3a3
12 changed files with 12013 additions and 10189 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
- name: Install PNPM
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.4.0
- name: Setup Node.js
uses: actions/setup-node@v4
+4 -4
View File
@@ -38,18 +38,18 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -63,4 +63,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
+96
View File
@@ -0,0 +1,96 @@
name: Pull Request
on:
pull_request:
paths-ignore:
- '.changeset/**'
- '.husky/**'
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 & pre-alpha release'
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v3
- name: Set SHA
id: sha
run: |
SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9.4.0
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Increment alpha
run: npm version 0.0.0-alpha.${{ steps.sha.outputs.short_sha }} --preid pr_${{ github.event.number }} --allow-same-version --workspace="packages/**" --if-present --no-git-tag-version
- name: Install
run: pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Build project
run: pnpm build
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: Publish alpha
run: npm publish --workspace="packages/**" --tag=pr_${{ github.event.number }} --access=public
- 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 NPM alpha release`,
body: `
@bbob/cli [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/cli/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/core [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/core/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/parser [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/parser/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/plugin-helper [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/plugin-helper/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/preset [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/types [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/types/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/preset-html5 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-html5/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/html [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/html/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/preset-react [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-react/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/react [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/react/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/preset-vue [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-vue/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/vue2 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/vue2/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
@bbob/vue3 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/vue3/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
`,
github,
repo: context.repo,
prNumber: context.payload.pull_request.number
})
+9 -2
View File
@@ -20,7 +20,7 @@ jobs:
- name: Install PNPM
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.4.0
- name: Setup Node.js
uses: actions/setup-node@v4
@@ -31,11 +31,18 @@ jobs:
- name: Install
run: pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Prepare release version
id: pre_release
run: |
RELEASE_VER=$(pnpm changeset status --output=./release.json && node scripts/ci/release-version.js | tail -n 1)
echo "version=${RELEASE_VER}" >> $GITHUB_OUTPUT
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
title: 'chore(release): publish ${{ steps.pre_release.outputs.version }}'
publish: pnpm release
commit: 'chore(release): release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+2 -2
View File
@@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 19.x]
node-version: [18.x, 19.x, 20.x]
steps:
- name: Checkout repository
@@ -23,7 +23,7 @@ jobs:
- name: Install PNPM
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.4.0
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4