mirror of
https://github.com/alexgo-io/stacks.js.git
synced 2026-01-12 17:52:41 +08:00
53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
name: pull-request
|
|
on:
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pre-run:
|
|
uses: ./.github/workflows/pre-run.yml
|
|
secrets: inherit
|
|
|
|
tests:
|
|
needs: pre-run
|
|
uses: ./.github/workflows/tests.yml
|
|
|
|
publish-pr:
|
|
runs-on: ubuntu-latest
|
|
needs: [pre-run, tests]
|
|
if: needs.pre-run.outputs.is-not-fork == 'true'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
- uses: actions/checkout@v3
|
|
if: github.event_name == 'workflow_dispatch'
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run bootstrap
|
|
- id: git-commit
|
|
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
|
|
- run: echo $SHA
|
|
env:
|
|
SHA: ${{ steps.git-commit.outputs.sha }}
|
|
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
- run: npx lerna publish prepatch --preid pr.$SHA --dist-tag pr --no-verify-access --no-push --no-git-tag-version --yes
|
|
env:
|
|
SHA: ${{ steps.git-commit.outputs.sha }}
|
|
SKIP_TESTS: true
|
|
- id: published-version
|
|
run: echo "::set-output name=version::$(cat lerna.json | jq -r '.version')"
|
|
- uses: janniks/pull-request-fixed-header@v1.0.1
|
|
with:
|
|
header: "> This PR was published to npm with the version `${{ steps.published-version.outputs.version }}`\n> e.g. `npm install @stacks/common@${{ steps.published-version.outputs.version }} --save-exact`"
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|