Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SC-32565] Setup publishing on NPM #2

Merged
merged 7 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
node-modules-dot-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
- run: npm ci --prefer-offline --no-audit
- run: npm run prettier
- run: npx tsc --noEmit
- run: npm run test:ci
- run: npm run eslint
- run: npm run build
namoscato marked this conversation as resolved.
Show resolved Hide resolved
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Publish to npm"

on:
release:
types: [released]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false # enqueue deployment jobs

env:
SLACK_DEPLOY_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}
SLACK_DEPLOY_CHANNEL: ${{ vars.SLACK_DEPLOY_CHANNEL }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Post to Slack
uses: Fieldguide/action-slack-deploy-pipeline@v1
id: slack
namoscato marked this conversation as resolved.
Show resolved Hide resolved

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

- name: Parse version
id: version
run: echo "value=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT

- name: Update npm package version for build / publishing
run: npm version ${{ steps.version.outputs.value }} --no-git-tag-version

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
registry-url: "https://registry.npmjs.org"
scope: "@fieldguide"

- name: Install dependencies
run: npm ci --prefer-offline --no-audit

- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: "Post to Slack"
uses: Fieldguide/action-slack-deploy-pipeline@v1
if: always()
with:
thread_ts: ${{ steps.slack.outputs.ts }}
conclusion: true
Loading