Docker Build and Push #23
This file contains 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: Docker Build and Push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'ci/**' | ||
- 'wbmbot_v2/**' | ||
workflow_run: | ||
workflows: ["Release and Auto Change Log"] | ||
types: | ||
- completed | ||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Fetch tags | ||
run: git fetch --tags | ||
- name: Get latest tag | ||
id: latest_tag | ||
run: echo "TAG=$(git describe --abbrev=0 --tags || echo '')" >> "$GITHUB_ENV" | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build Docker image | ||
if: $TAG != '' | ||
Check failure on line 37 in .github/workflows/docker-build-push.yml
|
||
run: docker build -t vel7an/wbmbot_v2:${TAG} -t vel7an/wbmbot_v2:latest -f ci/docker/Dockerfile . | ||
- name: Push Docker image to Docker Hub | ||
if: $TAG != '' | ||
run: | | ||
docker push vel7an/wbmbot_v2:${TAG} | ||
docker push vel7an/wbmbot_v2:latest |