chore: version packages #405
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: pull-request | |
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
jobs: | |
pre-run: | |
uses: ./.github/workflows/pre-run.yml | |
secrets: inherit | |
commitlint: | |
runs-on: ubuntu-latest | |
needs: pre-run | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v5 | |
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: 18 | |
cache: npm | |
- run: npm install -g npm@latest | |
- run: npm ci | |
- 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/[email protected] | |
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 }} |