|
| 1 | +name: Release CLI Plugins (Production) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + workflow_dispatch: # manually trigger the workflow |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - uses: pnpm/action-setup@v4 |
| 14 | + with: |
| 15 | + version: 10.28.0 |
| 16 | + - uses: actions/setup-node@v4 |
| 17 | + with: |
| 18 | + node-version: '22.x' |
| 19 | + |
| 20 | + - name: Enable Corepack |
| 21 | + run: corepack enable |
| 22 | + |
| 23 | + - name: Install pnpm |
| 24 | + run: corepack prepare pnpm@10.28.0 --activate |
| 25 | + |
| 26 | + - name: Clean the repository |
| 27 | + run: pnpm run clean:all |
| 28 | + |
| 29 | + - name: Install root dependencies |
| 30 | + run: pnpm install --no-frozen-lockfile |
| 31 | + |
| 32 | + - name: Build all plugins |
| 33 | + run: pnpm -r --sort run build |
| 34 | + |
| 35 | + - name: Reading Configuration |
| 36 | + id: release_config |
| 37 | + uses: rgarcia-phi/json-to-variables@v1.1.0 |
| 38 | + with: |
| 39 | + filename: .github/config/release.json |
| 40 | + prefix: release |
| 41 | + |
| 42 | + # Variants |
| 43 | + - name: Publishing variants (Production) |
| 44 | + uses: JS-DevTools/npm-publish@v3 |
| 45 | + with: |
| 46 | + token: ${{ secrets.NPM_TOKEN }} |
| 47 | + package: ./packages/contentstack-variants/package.json |
| 48 | + tag: latest |
| 49 | + |
| 50 | + # Export |
| 51 | + - name: Publishing export (Production) |
| 52 | + uses: JS-DevTools/npm-publish@v3 |
| 53 | + with: |
| 54 | + token: ${{ secrets.NPM_TOKEN }} |
| 55 | + package: ./packages/contentstack-export/package.json |
| 56 | + tag: latest |
| 57 | + |
| 58 | + # Audit |
| 59 | + - name: Publishing audit (Production) |
| 60 | + uses: JS-DevTools/npm-publish@v3 |
| 61 | + with: |
| 62 | + token: ${{ secrets.NPM_TOKEN }} |
| 63 | + package: ./packages/contentstack-audit/package.json |
| 64 | + tag: latest |
| 65 | + |
| 66 | + # Import |
| 67 | + - name: Publishing import (Production) |
| 68 | + uses: JS-DevTools/npm-publish@v3 |
| 69 | + with: |
| 70 | + token: ${{ secrets.NPM_TOKEN }} |
| 71 | + package: ./packages/contentstack-import/package.json |
| 72 | + tag: latest |
| 73 | + |
| 74 | + # Clone |
| 75 | + - name: Publishing clone (Production) |
| 76 | + uses: JS-DevTools/npm-publish@v3 |
| 77 | + with: |
| 78 | + token: ${{ secrets.NPM_TOKEN }} |
| 79 | + package: ./packages/contentstack-clone/package.json |
| 80 | + tag: latest |
| 81 | + |
| 82 | + # Import Setup |
| 83 | + - name: Publishing import-setup (Production) |
| 84 | + uses: JS-DevTools/npm-publish@v3 |
| 85 | + with: |
| 86 | + token: ${{ secrets.NPM_TOKEN }} |
| 87 | + package: ./packages/contentstack-import-setup/package.json |
| 88 | + tag: latest |
| 89 | + |
| 90 | + # Export to CSV |
| 91 | + - name: Publishing export to csv (Production) |
| 92 | + uses: JS-DevTools/npm-publish@v3 |
| 93 | + with: |
| 94 | + token: ${{ secrets.NPM_TOKEN }} |
| 95 | + package: ./packages/contentstack-export-to-csv/package.json |
| 96 | + tag: latest |
| 97 | + |
| 98 | + # Migration |
| 99 | + - name: Publishing migration (Production) |
| 100 | + uses: JS-DevTools/npm-publish@v3 |
| 101 | + with: |
| 102 | + token: ${{ secrets.NPM_TOKEN }} |
| 103 | + package: ./packages/contentstack-migration/package.json |
| 104 | + tag: latest |
| 105 | + |
| 106 | + # Seed |
| 107 | + - name: Publishing seed (Production) |
| 108 | + uses: JS-DevTools/npm-publish@v3 |
| 109 | + with: |
| 110 | + token: ${{ secrets.NPM_TOKEN }} |
| 111 | + package: ./packages/contentstack-seed/package.json |
| 112 | + tag: latest |
| 113 | + |
| 114 | + # Bootstrap |
| 115 | + - name: Publishing bootstrap (Production) |
| 116 | + uses: JS-DevTools/npm-publish@v3 |
| 117 | + with: |
| 118 | + token: ${{ secrets.NPM_TOKEN }} |
| 119 | + package: ./packages/contentstack-bootstrap/package.json |
| 120 | + tag: latest |
| 121 | + |
| 122 | + # Bulk Publish |
| 123 | + - name: Publishing bulk publish (Production) |
| 124 | + uses: JS-DevTools/npm-publish@v3 |
| 125 | + with: |
| 126 | + token: ${{ secrets.NPM_TOKEN }} |
| 127 | + package: ./packages/contentstack-bulk-publish/package.json |
| 128 | + tag: latest |
| 129 | + |
| 130 | + # Branches |
| 131 | + - name: Publishing branches (Production) |
| 132 | + uses: JS-DevTools/npm-publish@v3 |
| 133 | + with: |
| 134 | + token: ${{ secrets.NPM_TOKEN }} |
| 135 | + package: ./packages/contentstack-branches/package.json |
| 136 | + tag: latest |
| 137 | + |
| 138 | + - name: Create Production Release |
| 139 | + id: create_release |
| 140 | + env: |
| 141 | + GITHUB_TOKEN: ${{ secrets.PKG_TOKEN }} |
| 142 | + VERSION: ${{ steps.publish-plugins.outputs.version }} |
| 143 | + run: | |
| 144 | + # Get the previous production release for comparison |
| 145 | + PREVIOUS_PROD=$(gh release list --limit 10 | grep -v 'prerelease' | head -1 | cut -f1) |
| 146 | +
|
| 147 | + if [ -n "$PREVIOUS_PROD" ]; then |
| 148 | + gh release create "v${VERSION}" --title "Production Release $VERSION" --notes-from-tag "$PREVIOUS_PROD" |
| 149 | + else |
| 150 | + gh release create "v${VERSION}" --title "Production Release $VERSION" --generate-notes |
| 151 | + fi |
0 commit comments