Skip to content

Vladdan16 patch 2

Vladdan16 patch 2 #11

Workflow file for this run

name: Frontend
on:
workflow_dispatch:
push:
paths:
- 'frontend/**'
branches: [ "main" ]
pull_request:
paths:
- 'frontend/**'
branches: [ "main" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: nad777/leetforces-frontend
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup dart
uses: dart-lang/setup-dart@v1
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install dependencies
run: cd frontend && dart pub get
- name: Verify formatting
run: cd frontend && dart format --output=none --set-exit-if-changed .
- name: Analyze project source
run: cd frontend && dart analyze --fatal-infos
- name: Build Web
run: cd frontend && flutter build web --release
- name: Log in to the Registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker Metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: frontend
file: ./frontend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha, mode=max