Skip to content

Commit f407348

Browse files
committed
Add GitHub Actions workflow for Docker image release on tag push
Signed-off-by: Teresa Romero <romero.teresa@protonmail.com>
1 parent 647c908 commit f407348

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+"
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v2
17+
18+
- name: Log in to Docker Hub
19+
uses: docker/login-action@v2
20+
with:
21+
username: ${{ secrets.DOCKERHUB_USERNAME }}
22+
password: ${{ secrets.DOCKERHUB_TOKEN }}
23+
24+
- name: Extract tag name
25+
id: tag
26+
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
27+
28+
- name: Build and push Docker image
29+
uses: docker/build-push-action@v4
30+
with:
31+
context: .
32+
push: true
33+
tags: |
34+
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ steps.tag.outputs.TAG }}
35+
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest

0 commit comments

Comments
 (0)