Delete build-pwa.sh #58
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
| # Workflow para crear tags automáticos basados en conventional commits | |
| name: Auto Version & Tag | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| # Permisos necesarios para el workflow | |
| permissions: | |
| contents: write # Necesario para crear tags y releases | |
| actions: read # Necesario para leer el workflow | |
| jobs: | |
| version-and-tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Obtener todo el historial para análisis de commits | |
| token: ${{ secrets.GITHUB_TOKEN }} # Usar token explícitamente | |
| - name: Determine Version Bump | |
| id: version | |
| run: | | |
| # Obtener la última tag | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "Last tag: $LAST_TAG" | |
| # Obtener commits desde la última tag | |
| if [ "$LAST_TAG" != "v0.0.0" ]; then | |
| COMMITS=$(git log ${LAST_TAG}..HEAD --oneline) | |
| else | |
| COMMITS=$(git log --oneline) | |
| fi | |
| echo "Commits since last tag:" | |
| echo "$COMMITS" | |
| # Si no hay commits nuevos, salir | |
| if [ -z "$COMMITS" ]; then | |
| echo "No new commits since last tag" | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| # Determinar el tipo de bump basado en conventional commits | |
| BUMP_TYPE="patch" | |
| if echo "$COMMITS" | grep -qE "^[a-f0-9]+ (feat|feature)(\(.+\))?!:|^[a-f0-9]+ .+BREAKING CHANGE:"; then | |
| BUMP_TYPE="major" | |
| elif echo "$COMMITS" | grep -qE "^[a-f0-9]+ (feat|feature)(\(.+\))?:"; then | |
| BUMP_TYPE="minor" | |
| elif echo "$COMMITS" | grep -qE "^[a-f0-9]+ (fix|bugfix|perf|refactor)(\(.+\))?:"; then | |
| BUMP_TYPE="patch" | |
| else | |
| echo "No version bump needed - no conventional commits found" | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "Bump type: $BUMP_TYPE" | |
| echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT | |
| # Calcular nueva versión | |
| VERSION_NUM=${LAST_TAG#v} | |
| IFS='.' read -ra VERSION_PARTS <<< "$VERSION_NUM" | |
| MAJOR=${VERSION_PARTS[0]:-0} | |
| MINOR=${VERSION_PARTS[1]:-0} | |
| PATCH=${VERSION_PARTS[2]:-0} | |
| case $BUMP_TYPE in | |
| major) | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| ;; | |
| minor) | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| ;; | |
| patch) | |
| PATCH=$((PATCH + 1)) | |
| ;; | |
| esac | |
| NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| echo "New version: $NEW_VERSION" | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| # Guardar commits para el release | |
| echo "commits<<EOF" >> $GITHUB_OUTPUT | |
| echo "$COMMITS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create Tag and Push | |
| if: steps.version.outputs.skip != 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Configurar git con el bot de GitHub Actions | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| NEW_VERSION="${{ steps.version.outputs.new_version }}" | |
| # Crear tag localmente | |
| git tag -a "$NEW_VERSION" -m "Release $NEW_VERSION" | |
| # Configurar la URL remota con el token | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git | |
| # Push del tag | |
| git push origin "$NEW_VERSION" | |
| echo "Created and pushed tag: $NEW_VERSION" | |
| - name: Create Release | |
| if: steps.version.outputs.skip != 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.new_version }} | |
| name: Release ${{ steps.version.outputs.new_version }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| 🚀 **Automatic release ${{ steps.version.outputs.new_version }}** | |
| ## Changes since last release: | |
| ``` | |
| ${{ steps.version.outputs.commits }} | |
| ``` | |
| --- | |
| *This release was created automatically based on conventional commits.* | |
| token: ${{ secrets.GITHUB_TOKEN }} |