name: Publish on: push: branches: - main paths: - "package.json" workflow_dispatch: jobs: publish: runs-on: ubuntu-latest permissions: contents: write id-token: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: pnpm/action-setup@v4 with: version: 9 - uses: actions/setup-node@v4 with: node-version: "20" cache: "pnpm" registry-url: "https://registry.npmjs.org" - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build for npm with zshy run: | cd action pnpm build:npm - name: Get version from package.json id: get_version run: | cd action VERSION=$(node -p "require('./package.json').version") echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Publishing version: $VERSION" - name: Create GitHub Release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ steps.get_version.outputs.version }} release_name: "@pullfrog/action v${{ steps.get_version.outputs.version }}" draft: false prerelease: false - name: Publish to npm run: | cd action npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}