Skip to content

Create docker-image.yml #1

Create docker-image.yml

Create docker-image.yml #1

Workflow file for this run

name: Docker Build and Push
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
# Only run if we have secrets for pushing or if it's a PR from the main repo
if: |

Check failure on line 13 in .github/workflows/docker-image.yml

View workflow run for this annotation

GitHub Actions / Docker Build and Push

Invalid workflow file

The workflow is not valid. .github/workflows/docker-image.yml (Line: 13, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_TOKEN || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) .github/workflows/docker-image.yml (Line: 26, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_TOKEN
secrets.DOCKERHUB_TOKEN ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: secrets.DOCKERHUB_TOKEN
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: ${{ secrets.DOCKERHUB_TOKEN != '' }}
tags: |
kagemnikarimu/scriptorium:latest
kagemnikarimu/scriptorium:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max