Version Packages (#170) #87
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 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Enable manual trigger | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build package | |
run: npm run build | |
- name: Check dist folder | |
run: | | |
if [ -d "dist" ]; then | |
echo "dist folder exists" | |
echo "dist/" | |
ls -la dist | |
else | |
echo "Error: dist folder does not exist" | |
echo "/" | |
pwd | |
ls -la | |
exit 1 | |
fi | |
- name: Display build logs | |
run: cat $(find . -name "*.log") | |
# Creates a release PR if unpublished changesets exist; publishes directly if there are no new changesets | |
- name: Create Release Pull Request or Publish | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: npm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |