ci: create docker push only workflow

and change default behaviour: deploy when tag is created instead
This commit is contained in:
Sonny
2024-03-27 23:38:06 +01:00
parent 20b0eac03a
commit 0bf5ac11b0
11 changed files with 3589 additions and 226 deletions

View File

@@ -1,32 +1,34 @@
name: CD
name: CI/CD prod
on:
push:
branches:
- main
release:
types: published
jobs:
push_image_to_docker_hub:
name: Push Docker image to Docker Hub
name: Build and push image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5.0.0
uses: docker/metadata-action@v5.5.1
with:
images: sonny93/my-links
flavor: latest=true
tags: |
type=sha,prefix=
type=semver,pattern={{version}}
- name: Login to DockerHub
uses: docker/login-action@v3.0.0
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@v5.3.0
with:
file: ./Dockerfile
context: .