CI/CD to Docker Hub #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD to Docker Hub | |
on: | |
push: | |
tags: | |
- 'v*' # This will trigger the workflow on any tag starting with 'v' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.HAMYAR_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.HAMYAR_DOCKERHUB_PASSWORD }} | |
- name: Extract version tag | |
id: extract_tag | |
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
# tags: hamyarchat/front:${{ env.TAG }} | |
tags: hamyarchat/front:latest | |
- name: Log out from Docker Hub | |
run: docker logout |