Skip to content

Commit

Permalink
ci: add npm publish actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kopach committed Nov 12, 2024
1 parent d5587d4 commit 21aa59f
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish to NPM on GH Release Publish

on:
push:
release:
types: [published]

jobs:
publish:
if: github.repository == 'brainly/gene'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.0

- name: Setup Node.js
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: '18.20.0'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Get NX projects
id: nx-projects
run: |
cwd_id=$(echo $PWD | (command -v md5sum &> /dev/null && md5sum || md5 -r) | awk '{print $1}')
grap_path="/tmp/nx-completion-$cwd_id.json"
pnpm nx graph --file="$grap_path" > /dev/null
ls -l $grap_path
cat $grap_path
projects=($(<$grap_path | jq -r '.graph.nodes[] | .name'))
echo "{projects}={projects[@]} >> $GITHUB_OUTPUT"
- name: Print NX projects
run: echo "${{ steps.nx-projects.outputs.projects }}"

# - name: Run ${{ matrix.target }}
# run: pnpm nx run-many --target=${{ matrix.target }} --all

# - name: Publish to NPM registry
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: npm publish

0 comments on commit 21aa59f

Please sign in to comment.