updated code release yml #35
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 CLI Core (v1 Beta) | ||
| on: | ||
| push: | ||
| branches: [v1-beta] | ||
| paths: | ||
| - 'packages/contentstack/package.json' | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10.28.0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22.x' | ||
| - name: Enable Corepack | ||
| run: corepack enable | ||
| - name: Install pnpm | ||
| run: corepack prepare pnpm@10.28.0 --activate | ||
| - name: Clean the repository | ||
| run: pnpm run clean:all | ||
| - name: Reading Configuration | ||
| id: release_config | ||
| uses: rgarcia-phi/json-to-variables@v1.1.0 | ||
| with: | ||
| filename: .github/config/release.json | ||
| prefix: release | ||
| # Core CLI | ||
| - name: Installing dependencies of core | ||
| id: core-installation | ||
| if: ${{env.release_releaseAll == 'true' || env.release_plugins_core == 'true'}} | ||
| working-directory: ./packages/contentstack | ||
| run: pnpm install --frozen-lockfile | ||
| - name: Compiling core | ||
| if: ${{ steps.core-installation.conclusion == 'success' }} | ||
| working-directory: ./packages/contentstack | ||
| run: pnpm run build | ||
| - name: Publishing core (Beta) | ||
| id: publish-core | ||
| uses: JS-DevTools/npm-publish@v3 | ||
| if: ${{ steps.core-installation.conclusion == 'success' }} | ||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} | ||
| package: ./packages/contentstack/package.json | ||
| tag: beta | ||
| - name: Create Core Beta Release | ||
| if: ${{ steps.publish-core.conclusion == 'success' }} | ||
| id: create_release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.PKG_TOKEN }} | ||
| VERSION: ${{ steps.publish-core.outputs.version }} | ||
| run: | | ||
| TAG="core@v${VERSION}" | ||
| if gh release view "$TAG" &>/dev/null; then | ||
| echo "Release $TAG already exists — skipping." | ||
| else | ||
| gh release create "$TAG" \ | ||
| --title "Core Beta $VERSION" \ | ||
| --generate-notes \ | ||
| --prerelease | ||
| fi | ||