Merge pull request #57 from availproject/chore/update-to-2.2.1 #4
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: Publish Package | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| NODE_VERSION: "24" | |
| PACKAGE_DIR: packages/widgets | |
| PACKAGE_NAME: "@avail-project/widgets" | |
| PNPM_VERSION: 11.1.3 | |
| jobs: | |
| publish: | |
| name: Publish @avail-project/widgets | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| registry-url: https://registry.npmjs.org | |
| package-manager-cache: false | |
| - name: Enable pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm@${PNPM_VERSION} --activate | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build widgets package | |
| run: pnpm build:widgets-package | |
| - name: Read package version | |
| id: package | |
| run: | | |
| VERSION="$(node -p "require('./${PACKAGE_DIR}/package.json').version")" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Ensure version is not already published | |
| run: | | |
| if npm view "${PACKAGE_NAME}@${{ steps.package.outputs.version }}" version --registry=https://registry.npmjs.org >/dev/null 2>&1; then | |
| echo "::error title=Version already published::${PACKAGE_NAME}@${{ steps.package.outputs.version }} already exists on npm." | |
| exit 1 | |
| fi | |
| - name: Preview package contents | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| run: npm pack --dry-run | |
| - name: Publish package with trusted publishing | |
| working-directory: ${{ env.PACKAGE_DIR }} | |
| run: npm publish --access public |