Skip to content

Commit

Permalink
fix: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Sep 8, 2024
1 parent b3cb9ed commit d0125dd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Prepare

description: Checkout, install dependencies, build and test JS library + setup npm for publish
description: Checkout, install dependencies, build and test JS library

inputs:
folder:
description: 'The folder in which to run npm ci'
required: false
default: '.'
dist:
description: 'The folder in which the library is built'
required: false
default: './dist'

runs:
using: composite
Expand All @@ -19,19 +15,18 @@ runs:
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
shell: bash
run: npm ci
working-directory: ${{ inputs.folder }}

- name: Build
shell: bash
run: npm run build
working-directory: ${{ inputs.folder }}

- name: Test
shell: bash
working-directory: ${{ inputs.folder }}
run: npm run test
- name: Set up npm
shell: bash
run: printf '%s\n' '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' registry=https://registry.npmjs.org/ always-auth=true >> .npmrc
working-directory: ${{ inputs.dist }}
working-directory: ${{ inputs.folder }}
12 changes: 7 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ jobs:
id-token: write
env:
working-directory: js-library
dist-directory: ${{env.working-directory}}/dist

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set dist-directory path
run: echo "DIST_DIRECTORY=${{env.working-directory}}/dist" >> $GITHUB_ENV

- name: Prepare and Build JS Library
run: ./scripts/build.sh $DIST_DIRECTORY
uses: ./.github/actions/prepare

- name: Package next
working-directory: ${{env.working-directory}}
run: ./scripts/package-next

- name: Set up npm
working-directory: ${{env.dist-directory}}
run: printf '%s\n' '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' registry=https://registry.npmjs.org/ always-auth=true >> .npmrc

- name: Publish
working-directory: $DIST_DIRECTORY
working-directory: ${{env.dist-directory}}
run: npm publish --provenance --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
12 changes: 7 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ jobs:
id-token: write
env:
working-directory: js-library
dist-directory: ${{env.working-directory}}/dist

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4

- name: Set dist-directory path
run: echo "DIST_DIRECTORY=${{env.working-directory}}/dist" >> $GITHUB_ENV

- name: Prepare and Build JS Library
run: ./scripts/build.sh $DIST_DIRECTORY
uses: ./.github/actions/prepare

- name: Set up npm
working-directory: ${{env.dist-directory}}
run: printf '%s\n' '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' registry=https://registry.npmjs.org/ always-auth=true >> .npmrc

- name: Publish
working-directory: $DIST_DIRECTORY
working-directory: ${{env.dist-directory}}
run: ./scripts/publish-npm.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
5 changes: 0 additions & 5 deletions js-library/scripts/package-next
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/usr/bin/env bash
set -eux

npm ci

: Package first the library
npm run build

: Then update the version to SEMANTIC_VERSION-next-DATE e.g. 0.0.1-next-2022-08-05T15:02
node ./scripts/update-version.mjs

0 comments on commit d0125dd

Please sign in to comment.