Skip to content

try tags

try tags #4

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- main
- build
tags:
- '*' # Push events to all tags
env:
DOCKERHUB_USERNAME: jordotech
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
IMAGE_NAME: fastapi-slackbot
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Get branch or tag name
id: branch_or_tag_name
run: echo ::set-output name=name::${GITHUB_REF#refs/*/}
- name: Determine tag
id: image_tag
run: |

Check failure on line 33 in .github/workflows/build_and_push.yml

View workflow run for this annotation

GitHub Actions / Build and Push Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/build_and_push.yml (Line: 33, Col: 14): Unexpected symbol: 'name#tags/'. Located at position 34 within expression: steps.branch_or_tag_name.outputs.name#tags/
if [[ "${{ steps.branch_or_tag_name.outputs.name }}" == "tags"* ]]; then
echo "::set-output name=tag::${{ steps.branch_or_tag_name.outputs.name#tags/ }}"
else
echo "::set-output name=tag::${{ github.sha }}"
fi
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.branch_name.outputs.branch }}