ci: cd y ci #70
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: 🚀⚡ Liberando versiones | |
| on: | |
| push: | |
| branches: | |
| - builderbot-prod | |
| jobs: | |
| ############ RELEASE ############ | |
| release-prod: | |
| if: ${{ !github.event.act }} | |
| name: Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set output | |
| id: vars | |
| run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
| - uses: pnpm/action-setup@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22.20.0 | |
| cache: 'pnpm' | |
| registry-url: https://registry.npmjs.org/ | |
| - run: corepack enable | |
| - name: Set User | |
| run: git config --global user.email "[email protected]" && git config --global user.name "Leifer Mendez" | |
| - name: Install NPM Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Bump version with standard-version (skip commit/tag) | |
| run: | | |
| # standard-version actualiza package.json y CHANGELOG.md | |
| # --skip.commit y --skip.tag para manejar commit nosotros | |
| # --release-as patch fuerza siempre un incremento mínimo de versión | |
| npx standard-version --skip.commit --skip.tag --release-as patch | |
| # Obtener la nueva versión | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "📦 Nueva versión: $NEW_VERSION" | |
| - name: Sync all packages with lerna | |
| run: | | |
| # Obtener versión del package.json raíz | |
| ROOT_VERSION=$(node -p "require('./package.json').version") | |
| echo "📦 Sincronizando todos los paquetes a versión: $ROOT_VERSION" | |
| # Actualizar lerna.json y todos los package.json de los paquetes | |
| npx lerna version $ROOT_VERSION --force-publish --yes --no-git-tag-version --no-push | |
| # Verificar versiones | |
| echo "📋 Versiones actualizadas:" | |
| npx lerna ls --json | jq -r '.[] | " - \(.name): \(.version)"' | |
| - name: get-npm-version | |
| id: package-version | |
| uses: martinbeentjes/npm-get-version-action@main | |
| - name: Build Package | |
| run: pnpm build:full | |
| - name: Commit and tag version changes | |
| run: | | |
| # Obtener versión para el commit | |
| VERSION=$(node -p "require('./package.json').version") | |
| # Hacer commit de todos los cambios | |
| git add -A | |
| git commit -m "chore(release): $VERSION [skip ci]" || true | |
| # Crear tag | |
| git tag -a "v$VERSION" -m "Release v$VERSION" || true | |
| echo "✅ Commit y tag creados para v$VERSION" | |
| - name: Push changes and tags | |
| run: | | |
| git push origin builderbot-prod --follow-tags | |
| echo "✅ Cambios y tags subidos al repositorio" | |
| - name: Release Latest | |
| run: npx lerna publish from-package --dist-tag latest --yes | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Release Github | |
| run: node ./scripts/github.js --version="${{ steps.package-version.outputs.current-version}}" --token="${{ secrets.GITHUB_TOKEN }}" |