Tags como marcadores de release
Un tag de Git es una etiqueta inmutable en un commit. Los tags anotados llevan nombre del tagger, fecha y mensaje; los lightweight son solo un nombre.
Crear tags
git tag -a v1.4.0 -m "Release 1.4.0"
git tag -s v1.4.0 -m "Release 1.4.0"
git tag v1.4.0-alpha
Push de tags
git push origin v1.4.0
git push --tags
git push --follow-tags
Disparar CI en tags
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SemVer y prereleases
if [[ "$TAG" =~ -(alpha|beta|rc) ]]; then
npm publish --tag next
else
npm publish
fi
Generar changelogs desde tags
git log v1.3.0..v1.4.0 --oneline --no-merges
npx conventional-changelog -p angular -i CHANGELOG.md -s
Listar e inspeccionar tags
git tag
git tag -l 'v1.*'
git show v1.4.0
git tag --contains <sha>
git describe --tags HEAD
Eliminar y mover tags
git tag -d v1.4.0
git push origin --delete v1.4.0
git tag -a v1.4.0 -m "Release 1.4.0" <new-sha>
git push origin v1.4.0