|
| 1 | +name: Release CLI Core (v1 Beta) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [v1-beta] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - uses: pnpm/action-setup@v4 |
| 13 | + with: |
| 14 | + version: 7 |
| 15 | + - uses: actions/setup-node@v4 |
| 16 | + with: |
| 17 | + node-version: '22.x' |
| 18 | + |
| 19 | + - name: Enable Corepack |
| 20 | + run: corepack enable |
| 21 | + |
| 22 | + - name: Install pnpm |
| 23 | + run: corepack prepare pnpm@7 --activate |
| 24 | + |
| 25 | + - name: Install root dependencies |
| 26 | + run: pnpm install |
| 27 | + |
| 28 | + - name: Reading Configuration |
| 29 | + id: release_config |
| 30 | + uses: rgarcia-phi/json-to-variables@v1.1.0 |
| 31 | + with: |
| 32 | + filename: .github/config/release.json |
| 33 | + prefix: release |
| 34 | + |
| 35 | + # Core CLI |
| 36 | + - name: Installing dependencies of core |
| 37 | + id: core-installation |
| 38 | + if: ${{env.release_releaseAll == 'true' || env.release_plugins_core == 'true'}} |
| 39 | + working-directory: ./packages/contentstack |
| 40 | + run: npm install |
| 41 | + - name: Compiling core |
| 42 | + if: ${{ steps.core-installation.conclusion == 'success' }} |
| 43 | + working-directory: ./packages/contentstack |
| 44 | + run: npm run prepack |
| 45 | + - name: Publishing core (Beta) |
| 46 | + id: publish-core |
| 47 | + uses: JS-DevTools/npm-publish@v3 |
| 48 | + if: ${{ steps.core-installation.conclusion == 'success' }} |
| 49 | + with: |
| 50 | + token: ${{ secrets.NPM_TOKEN }} |
| 51 | + package: ./packages/contentstack/package.json |
| 52 | + tag: beta |
| 53 | + |
| 54 | + - name: Create Core Beta Release |
| 55 | + if: ${{ steps.publish-core.conclusion == 'success' }} |
| 56 | + id: create_release |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + VERSION: ${{ steps.publish-core.outputs.version }} |
| 60 | + run: | |
| 61 | + # Look for the last release specifically starting with the 'core@v' prefix |
| 62 | + PREVIOUS_BETA=$(gh release list --limit 50 | grep 'core@v' | grep 'beta' | head -1 | cut -f1) |
| 63 | +
|
| 64 | + if [ -n "$PREVIOUS_BETA" ]; then |
| 65 | + # Compare current core version against previous core version |
| 66 | + gh release create "core@v$VERSION" --title "Core Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease |
| 67 | + else |
| 68 | + # Fallback if this is the first core@v release |
| 69 | + gh release create "core@v$VERSION" --title "Core Beta $VERSION" --generate-notes --prerelease |
| 70 | + fi |
0 commit comments