Skip to content

Import initial cpp files #12

Import initial cpp files

Import initial cpp files #12

Workflow file for this run

################################################################################
#
# Copyright (C) 2023 retro.ai
# This file is part of retro-dapp - https://github.com/RetroAI/retro-dapp
#
# SPDX-License-Identifier: Apache-2.0
# See the file LICENSE for more information.
#
################################################################################
name: Build and Deploy
on:
push:
branches:
- main
paths:
# Only run the workflow when files in frontend change
- 'frontend/**'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
# Set the working directory to frontend folder
working-directory: frontend
steps:
- name: Checkout 🛎️
# If you're using actions/checkout you should set persist-credentials
# to false in most cases for the deployment to work correctly
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cache Frontend Directory
uses: actions/cache@v3
with:
path: frontend
key: frontend-${{ runner.os }}-${{ hashFiles('frontend/**') }}
- name: Calculate Frontend Hash
id: hash
run: echo "::set-output name=hash::$(md5sum frontend/** | md5sum | awk '{print $1}')"
- name: Check for Changes in Frontend
run: |
if [ "${{ steps.hash.outputs.hash }}" = "${{ steps.hash.outputs.prevHash }}" ]; then
echo "No changes in frontend/ directory. Skipping the workflow."
exit 0
else
echo "Changes detected in frontend/ directory. Proceeding with the workflow."
fi
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install and Build
run: |
yarn install
yarn build
- name: Deploy to retroai.github.io 🚀
run: |
cd ..
git clone https://github.com/RetroAI/retroai.github.io.git deployed-repo
rsync -av --delete --exclude .git frontend/dist/ deployed-repo/
cd deployed-repo
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add .
git commit -m "Deployed new build from retro-dapp repository"
git push https://${{secrets.GH_PAT}}@github.com/RetroAI/retroai.github.io.git main