fix(ci): publish npm package from outside pnpm workspace #26
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| build: | |
| name: Build ${{ matrix.artifact }} | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest # arm64 GitHub-hosted runner | |
| artifact: macos-arm64 | |
| build_cmd: bash scripts/build-release.sh macos-arm64 | |
| upload_file: marionette-macos-arm64.tar.gz | |
| - os: macos-15-intel # x64 GitHub-hosted runner (macos-13 retired Dec 2025) | |
| artifact: macos-x64 | |
| build_cmd: bash scripts/build-release.sh macos-x64 | |
| upload_file: marionette-macos-x64.tar.gz | |
| - os: ubuntu-latest | |
| artifact: linux-x64 | |
| build_cmd: bash scripts/build-release.sh linux-x64 | |
| upload_file: marionette-linux-x64.tar.gz | |
| - os: windows-latest | |
| artifact: windows-x64 | |
| build_cmd: pwsh scripts/build-release.ps1 windows-x64 | |
| upload_file: marionette-windows-x64.zip | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build release archive | |
| run: ${{ matrix.build_cmd }} | |
| - name: Upload release artifact | |
| run: gh release upload "${{ github.ref_name }}" "${{ matrix.upload_file }}" --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-npm: | |
| name: Publish @marionette-app/cli to npm | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish to npm | |
| run: | | |
| VERSION="${{ github.ref_name }}" | |
| VERSION="${VERSION#v}" | |
| # Patch version directly to avoid npm workspace protocol errors | |
| node -e " | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('packages/cli/package.json', 'utf8')); | |
| pkg.version = '$VERSION'; | |
| fs.writeFileSync('packages/cli/package.json', JSON.stringify(pkg, null, 2) + '\n'); | |
| " | |
| # Publish from /tmp to avoid npm picking up pnpm workspace:* deps | |
| cp -r packages/cli /tmp/marionette-cli | |
| cd /tmp/marionette-cli | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |