ci(@leav/ui): publish build on puhs on develop #5
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
# .github/workflows/publish-ui.yml | ||
# Workflow name | ||
name: "Publish @next nightly Package to npmjs" | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- chore/publish-ui-next # TO DELETE | ||
paths: | ||
- libs/ui/** | ||
- .github/workflows/** # TO DELETE | ||
workflow_dispatch: | ||
secrets: | ||
NPM_TOKEN: | ||
description: 'Npm Token' | ||
required: false | ||
jobs: | ||
install: | ||
uses: ./.github/workflows/install.yml | ||
Check failure on line 22 in .github/workflows/publish-ui.yml GitHub Actions / .github/workflows/publish-ui.ymlInvalid workflow file
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- install | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
cache: 'yarn' | ||
- name: move into ui package | ||
run: cd libs/ui | ||
- name: build design system | ||
run: yarn build | ||
prepublish: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
outputs: | ||
version: ${{ steps.version.outputs.next_version }} | ||
exists: ${{ steps.check.outputs.exists }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: 'develop' | ||
- name: get next version | ||
id: version | ||
run: | | ||
echo "next_version=$(cat libs/ui/package.json | jq -r '.version')-$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_OUTPUT" | ||
echo "next_version=$(cat libs/ui/package.json | jq -r '.version')-$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | ||
- name: Update package.json version | ||
uses: jossef/[email protected] | ||
with: | ||
file: libs/ui/package.json | ||
field: version | ||
value: ${{ env.next_version }} | ||
- name: Check publish status | ||
id: check_npm | ||
uses: tehpsalmist/npm-publish-status-action@v1 | ||
- name: set check npm variable | ||
id: check | ||
run: | | ||
echo "exists=${{ steps.check_npm.outputs.exists }}" >> "$GITHUB_OUTPUT" | ||
publish-next: | ||
runs-on: ubuntu-latest | ||
needs: prepublish | ||
if: ${{needs.prepublish.outputs.exists == '0'}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: 'develop' | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'yarn' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Update package.json version | ||
uses: jossef/[email protected] | ||
with: | ||
file: libs/ui/package.json | ||
field: version | ||
value: ${{ needs.prepublish.outputs.version }} | ||
- name: move into ui package | ||
run: cd libs/ui | ||
- name: install dependencies | ||
run: yarn | ||
- name: build project | ||
run: yarn build | ||
- run: npm publish --tag next | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||