-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.74 KB
/
docker-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 }}