Skip to content

CORS

CORS #19

Workflow file for this run

name: Tomohub
on:
push:
tags:
- 'v*'
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Checkout the repository code
- name: Checkout Code
uses: actions/[email protected]
# Generate the image names dynamically
- name: Generate Image Names
run: |
echo FRONTEND_IMAGE=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]')-frontend >> $GITHUB_ENV
echo BACKEND_IMAGE=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]')-backend >> $GITHUB_ENV
# Log in to GitHub Container Registry
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/[email protected]
# Build and push the frontend image
- name: Build and Push Frontend Image
uses: docker/[email protected]
with:
context: ./frontend # Path to the frontend directory
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
tags: ${{ env.FRONTEND_IMAGE }}:latest
labels: |
org.opencontainers.image.source=${{ github.repository_url }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Build and push the backend image
- name: Build and Push Backend Image
uses: docker/[email protected]
with:
context: ./backend # Path to the backend directory
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
tags: ${{ env.BACKEND_IMAGE }}:latest
labels: |
org.opencontainers.image.source=${{ github.repository_url }}
cache-from: type=gha
cache-to: type=gha,mode=max