Skip to content

Commit 1104a92

Browse files
ci(release): dual trigger (tags + release) and correct TAG wiring (#75)
1 parent baf029a commit 1104a92

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
name: release
22
on:
3+
push:
4+
tags: ['v*'] # cuando semantic-release crea el tag
35
release:
4-
types: [published]
6+
types: [published] # cuando el GitHub Release se publica
57

68
permissions:
79
contents: read
810
packages: write
911

12+
concurrency:
13+
group: release-${{ github.ref }}
14+
cancel-in-progress: true
15+
1016
jobs:
1117
ghcr:
12-
if: startsWith(github.event.release.tag_name, 'v')
1318
runs-on: ubuntu-latest
19+
env:
20+
# nombre de imagen SIEMPRE en minúsculas
21+
IMAGE: ghcr.io/${{ github.repository }}
22+
TAG: ${{ github.ref_type == 'tag' && github.ref_name || github.event.release.tag_name }}
1423
steps:
1524
- uses: actions/checkout@v4
25+
26+
- name: Lowercase image name
27+
run: echo "IMAGE=${IMAGE,,}" >> "$GITHUB_ENV"
28+
29+
- uses: docker/setup-qemu-action@v3
1630
- uses: docker/setup-buildx-action@v3
1731
- uses: docker/login-action@v3
1832
with:
1933
registry: ghcr.io
2034
username: ${{ github.actor }}
2135
password: ${{ secrets.GITHUB_TOKEN }}
22-
- name: Set env
23-
run: |
24-
echo "TAG=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV"
25-
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
26-
- name: Build & push (amd64+arm64)
27-
run: |
28-
docker buildx build \
29-
--platform linux/amd64,linux/arm64 \
30-
-t "$IMAGE:$TAG" -t "$IMAGE:latest" \
31-
--push .
36+
37+
- uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
file: ./Dockerfile
41+
platforms: linux/amd64
42+
push: true
43+
provenance: false
44+
tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ env.TAG }}

0 commit comments

Comments
 (0)