Skip to content

Pass in secret

Pass in secret #7

Workflow file for this run

# Candace Savonen Jan 2024
name: Build Docker
on:
workflow_dispatch:
inputs:
dockerhubpush:
description: 'Push to Dockerhub?'
required: true
default: 'false'
tag:
description: 'What tag to use?'
required: true
default: 'none'
jobs:
build-docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
token: ${{secrets.GH_PAT}}

Check failure on line 24 in .github/workflows/docker-build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-build.yml

Invalid workflow file

You have an error in your yaml syntax on line 24
# Set up Docker build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Setup layer cache
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Set up Docker build
- name: Set up Docker Build
uses: docker/setup-buildx-action@v1
- name: Get token
run: echo ${{ secrets.GH_PAT }} > ${{ inputs.directory }}/git_token.txt
# Build docker image
- name: Build Docker image
uses: docker/build-push-action@v2
with:
push: false
load: true
context: docker
file: inst/extdata/Dockerfile
tags: cansav09/metricminer
# Login to Dockerhub
- name: Login to DockerHub
if: ${{ github.event.inputs.dockerhubpush != 'false' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Push the Docker image if set to true from a manual trigger
- name: Push Docker image if manual trigger set to true
if: ${{ github.event.inputs.dockerhubpush != 'false' }}
run: |
docker tag cansav09/metricminer:latest cansav09/metricminer:$github.event.inputs.tag
docker push cansav09/metricminer:$github.event.inputs.tag