forked from finos/architecture-as-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finos#595 - updated action to work underworkspaces.
Also updated README to reflect how to trigger a release.
- Loading branch information
Showing
2 changed files
with
51 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
name: Publish to NPM | ||
name: Publish CLI to NPM | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
publish-cli: | ||
runs-on: ubuntu-latest | ||
# use 'if' to prevent endless looping with npm package commit | ||
if: "!startsWith(github.event.head_commit.message, '[RELEASE]')" | ||
defaults: | ||
run: | ||
working-directory: ./cli | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- run: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- run: git config user.name "$GITHUB_ACTOR" | ||
# prepend '[RELEASE]' so that it can be detected above to prevent looping | ||
# this is a commit to main that can be ignored by this GitHub action | ||
# use 'patch' to update only the last digit in the version (e.g. 1.1.?) | ||
# - run: npm version patch -m "[RELEASE] %s" | ||
# - run: git push | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v4 | ||
|
||
# Checkout the code | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Set up Node.js | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm publish --access=public | ||
node-version: v20 | ||
|
||
# Install the workspace | ||
- name: Install workspace | ||
run: npm ci | ||
|
||
# Build the entire workspace | ||
- name: Build workspace | ||
run: npm run build | ||
|
||
# Publish the CLI module | ||
- name: Publish CLI module | ||
run: npm publish --workspace cli | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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