Skip to content

ci: implement push latest image process #34

ci: implement push latest image process

ci: implement push latest image process #34

Workflow file for this run

name: Docker Image CI
on:
pull_request:
branches: ['main']
paths:
- 'Dockerfile'
- 'scripts/*'
- '.github/workflows/*'
push:
branches: ['main']
paths:
- 'Dockerfile'
- 'scripts/*'
- '.github/workflows/*'
jobs:
build:
runs-on: ubuntu-latest
environment: docker
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag "devops-toolkit-merge:$GITHUB_SHA"
- name: Verify tool versions
run: |
cd scripts
chmod +x check_version_in_toolkit.sh
./check_version_in_toolkit.sh "devops-toolkit-merge:$GITHUB_SHA"
- name: Push Docker Image
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
docker tag "devops-toolkit-merge:$GITHUB_SHA" "tungbq/devops-toolkit:main-${GITHUB_SHA::7}"
# docker push "tungbq/devops-toolkit:main-${GITHUB_SHA::7}"