File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *' # Triggers on any tag push
7+
8+ env :
9+ REGISTRY : docker.io
10+ IMAGE_NAME : ${{ secrets.DOCKERHUB_USERNAME }}/actual-rest-api
11+
12+ jobs :
13+ build-and-push :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : read
17+
18+ steps :
19+ - name : Checkout repository
20+ uses : actions/checkout@v4
21+
22+ - name : Set up Docker Buildx
23+ uses : docker/setup-buildx-action@v3
24+
25+ - name : Log in to Docker Hub
26+ uses : docker/login-action@v3
27+ with :
28+ username : ${{ secrets.DOCKERHUB_USERNAME }}
29+ password : ${{ secrets.DOCKERHUB_TOKEN }}
30+
31+ - name : Extract tag name
32+ id : tag
33+ run : |
34+ TAG_NAME=${GITHUB_REF#refs/tags/}
35+ echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
36+ echo "Tag name: $TAG_NAME"
37+
38+ - name : Build and push Docker image
39+ uses : docker/build-push-action@v5
40+ with :
41+ context : .
42+ file : ./Dockerfile
43+ push : true
44+ tags : |
45+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
46+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
47+ cache-from : type=gha
48+ cache-to : type=gha,mode=max
49+
You can’t perform that action at this time.
0 commit comments