Skip to content

Commit

Permalink
feat: npm publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
nakzyu committed May 13, 2024
1 parent 616b91b commit c6f36f9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Releases
on:
push:
branches:
- main

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check if version changed
id: version_changed
run: |
git diff --name-only HEAD^ HEAD | grep "^packages/headlessui-react-native/package.json$"
if [ $? -eq 0 ]; then
echo "::set-output name=version_changed::true"
else
echo "::set-output name=version_changed::false"
fi
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/[email protected]
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
version-file: "./packages/headlessui-react-native/package.json"
- name: create release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish to NPM
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Publish package on NPM 📦
run: npm run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "headlessui-react-native-monorepo",
"private": true,
"scripts": {
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint"
"lint": "turbo lint",
"publish": "cd packages/headlessui-react-native && npm publish"
},
"engines": {
"node": ">=18"
Expand Down

0 comments on commit c6f36f9

Please sign in to comment.