Skip to content

fix-semgrep

fix-semgrep #100

name: Docker Release
on:
push:
branches:
- main
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout código
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generar versión automática
id: version
run: |
VERSION=$(date +'%Y.%m.%d.%H%M')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Versión generada: ${VERSION}"
- name: Login en Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build y Push a Docker Hub
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/proyecto-codigo-u3:latest
${{ secrets.DOCKERHUB_USERNAME }}/proyecto-codigo-u3:${{ env.VERSION }}
- name: Configurar Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Crear y pushear tag
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: Crear Release en GitHub
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body: |
🚀 Nueva versión desplegada:
- Docker Hub: ${{ secrets.DOCKERHUB_USERNAME }}/proyecto-codigo-u3:${{ env.VERSION }}
- Fecha: $(date +'%Y-%m-%d %H:%M:%S')
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}