Skip to content

Build and push an image of Crypter.Web to GitHub Container Registry #14

Build and push an image of Crypter.Web to GitHub Container Registry

Build and push an image of Crypter.Web to GitHub Container Registry #14

name: Build and push an image of Crypter.Web to GitHub Container Registry
on:
release:
types:
- published
workflow_dispatch:
inputs:
environment:
description: 'Define the environment name'
required: true
type: choice
options:
- production
- development
env:
registry: ghcr.io/${{ github.repository_owner }}
jobs:
build-and-push-web-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
project_root: Crypter.Web/
environment:
name: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.environment) || 'production' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Replace tokens in configuration
working-directory: ${{ env.project_root }}
run: |
sed -i 's|${API_BASE_URL}|${{ vars.API_BASE_URL }}|g' wwwroot/appsettings.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
flavor: |

Check failure on line 55 in .github/workflows/build-and-push-web.yml

View workflow run for this annotation

GitHub Actions / Build and push an image of Crypter.Web to GitHub Container Registry

Invalid workflow file

The workflow is not valid. .github/workflows/build-and-push-web.yml (Line: 55, Col: 19): Unrecognized named-value: 'latest'. Located at position 46 within expression: (github.event_name == 'workflow_dispatch' && latest=true) || latest=auto
${{ (github.event_name == 'workflow_dispatch' && latest=true) || latest=auto }}
images: ${{ env.registry }}/${{ vars.WEB_IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Crypter.Web.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}