mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 14:43:24 +00:00
ci: create docker push only workflow
and change default behaviour: deploy when tag is created instead
This commit is contained in:
20
.github/workflows/CD.yml
vendored
20
.github/workflows/CD.yml
vendored
@@ -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: .
|
||||
|
||||
Reference in New Issue
Block a user