feat: add clarity version #578
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, workflow_dispatch] | |
jobs: | |
check_fork: | |
name: Disable jobs for forks | |
runs-on: ubuntu-latest | |
outputs: | |
is_not_fork: ${{ steps.is_not_fork.outputs.is_not_fork }} | |
steps: | |
- name: Check for secret | |
id: is_not_fork | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
echo "Is a fork: ${{ env.NPM_TOKEN == '' }}" | |
echo "::set-output name=is_not_fork::${{ env.NPM_TOKEN != '' }}" | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: wagoid/commitlint-github-action@v5 | |
code_checks: | |
name: Code checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Code Checks | |
uses: ./.github/actions/code-checks | |
publish_npm_betas: | |
name: Publish NPM beta versions | |
runs-on: ubuntu-latest | |
needs: [check_fork] | |
if: needs.check_fork.outputs.is_not_fork == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install monorepo deps | |
run: npm ci | |
- name: Setup .npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc | |
- name: Get git branch | |
id: git-branch | |
run: echo "::set-output name=branch::$(git rev-parse --abbrev-ref HEAD | cut -d'/' -f2 )" | |
- name: Get git commit | |
id: git-commit | |
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)" | |
- name: print preid | |
env: | |
BRANCH: ${{ steps.git-branch.outputs.branch }} | |
SHA: ${{ steps.git-commit.outputs.sha }} | |
run: echo $BRANCH.$SHA | |
- name: Setup git | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Publish to NPM | |
env: | |
BRANCH: ${{ steps.git-branch.outputs.branch }} | |
SHA: ${{ steps.git-commit.outputs.sha }} | |
run: npx lerna publish prepatch --preid alpha.$SHA --dist-tag $BRANCH --yes --no-push | |
- name: Get alpha package versions | |
id: alpha | |
run: | | |
echo "connect=$(cat packages/connect/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT" | |
echo "connectreact=$(cat packages/connect-react/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT" | |
echo "connectui=$(cat packages/connect-ui/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT" | |
- uses: janniks/[email protected] | |
with: | |
header: "> This PR was published to npm with the alpha versions:\n> - connect `npm install @stacks/connect@${{ steps.alpha.outputs.connect }} --save-exact`\n> - connect-react `npm install @stacks/connect-react@${{ steps.alpha.outputs.connectreact }} --save-exact`\n> - connect-ui `npm install @stacks/connect-ui@${{ steps.alpha.outputs.connectui }} --save-exact`" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |