feat: publish public packages #5
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
name: Publish Package and Create Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "packages/headlessui-react-native/package.json" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
cache: yarn | |
- name: Setup yarn | |
run: npm install -g yarn | |
- name: Install dependencies | |
run: yarn install | |
- name: Get package version | |
id: package-version | |
run: echo ::set-output name=version::$(node -p "require('./packages/headlessui-react-native/package.json').version") | |
- name: Authenticate with NPM | |
run: | | |
npm set //registry.npmjs.org/:_authToken="${{ secrets.NPM_ACCESS_TOKEN }}" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
- name: Publish to NPM | |
run: npm publish ./packages/headlessui-react-native --access public | |
- name: Package build | |
run: npm pack | |
working-directory: ./packages/headlessui-react-native | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
with: | |
tag_name: v${{ steps.package-version.outputs.version }} | |
release_name: Release v${{ steps.package-version.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./packages/headlessui-react-native/headlessui-react-native-${{ steps.package-version.outputs.version }}.tgz | |
asset_name: headlessui-react-native-${{ steps.package-version.outputs.version }}.tgz | |
asset_content_type: application/gzip |