Skip to content

Docker Build and Push #23

Docker Build and Push

Docker Build and Push #23

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

View workflow run for this annotation

GitHub Actions / Docker Build and Push

Invalid workflow file

The workflow is not valid. .github/workflows/docker-build-push.yml (Line: 37, Col: 13): Unexpected symbol: '$TAG'. Located at position 1 within expression: $TAG != '' .github/workflows/docker-build-push.yml (Line: 41, Col: 13): Unexpected symbol: '$TAG'. Located at position 1 within expression: $TAG != ''
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