fix: change build output to build/ dir #47
This file contains hidden or 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 to npm and Create GitHub Release | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write # Allow creation of releases and commits | |
| issues: write # Allow commenting on issues/PRs (optional) | |
| pull-requests: write # Allow commenting on issues/PRs (optional) | |
| packages: write # Allow publishing to GitHub Packages (if used alongside npm) | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.sha }} # Explicitly checkout the triggering commit SHA | |
| fetch-depth: 0 # Essential for semantic-release to analyze history | |
| persist-credentials: false # Recommended practice | |
| # Remove explicit Node setup - pnpm/action-setup handles it | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 20 | |
| # cache: 'pnpm' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| # Version is read from package.json's "packageManager" field | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Verify package.json before build | |
| run: cat package.json | |
| - name: Build | |
| run: pnpm run build | |
| - name: List build contents | |
| run: ls -lR build | |
| # Optional: Add a test step here if you have tests | |
| # - name: Test | |
| # run: pnpm test | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Pack tarball locally for inspection | |
| run: pnpm pack --pack-destination ./ci-pack | |
| - name: List tarball contents | |
| run: tar -tvf ./ci-pack/*.tgz | |
| - name: Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Use NPM_TOKEN as expected by @semantic-release/npm | |
| run: pnpm semantic-release |