-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish version on NPM when release is published (#24)
- Loading branch information
1 parent
0058b9e
commit 9f28c51
Showing
1 changed file
with
54 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Release" | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-package-version: | ||
name: Check package version and detect an update | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
committed-version: ${{ steps.check-package-version.outputs.committed-version }} | ||
published-version: ${{ steps.check-package-version.outputs.published-version }} | ||
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }} | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check package version and detect an update | ||
id: check-package-version | ||
uses: PostHog/check-package-version@v2 | ||
|
||
release: | ||
name: Publish release if new version | ||
runs-on: ubuntu-24.04 | ||
needs: check-package-version | ||
if: needs.check-package-version.outputs.is-new-version == 'true' | ||
env: | ||
COMMITTED_VERSION: ${{ needs.check-package-version.outputs.committed-version }} | ||
PUBLISHED_VERSION: ${{ needs.check-package-version.outputs.published-version }} | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} | ||
|
||
- name: Setup Yarn | ||
uses: threeal/setup-yarn-action@v2.0.0 | ||
|
||
- name: Set up Node 18 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Install package.json dependencies with yarn | ||
run: yarn install | ||
|
||
- name: Publish the package in the npm registry | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |