Skip to content

Merge pull request #183 from 0101oak/fix/composition-field-clear-btn #185

Merge pull request #183 from 0101oak/fix/composition-field-clear-btn

Merge pull request #183 from 0101oak/fix/composition-field-clear-btn #185

Workflow file for this run

# Name of the GitHub Actions Workflow
name: Build and deploy to GitHub Pages
# Triggers for the Workflow
on:
push:
branches:
- master # Trigger the workflow on push events to the main branch
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest # The type of runner that the job will run on
steps:
# Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
uses: actions/checkout@v3
# Sets up a Node.js environment using the version specified in .nvmrc
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
# Caches dependencies for faster subsequent runs
- name: Cache Node Modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Performs security scanning to identify known vulnerabilities in dependencies
- name: Security Scanning
run: |
npm install
npm audit --production # Focuses on production dependencies
continue-on-error: true # Allows the workflow to continue even if vulnerabilities are found
- name: Install Buf
run: |
curl -sSL \
"https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64" \
-o /usr/local/bin/buf
chmod +x /usr/local/bin/buf
# Install Go and protoc-gen-typescript-http
- name: Install Go and protoc-gen-typescript-http
run: |
# Add the Golang backport PPA
sudo add-apt-repository ppa:longsleep/golang-backports -y
sudo apt-get update
# Install Go
sudo apt-get install golang-go -y
# Configure environment variables for Go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# Install protoc-gen-typescript-http tool
go install go.einride.tech/protoc-gen-typescript-http@latest
# Append Go path to the GitHub Environment
echo "GOPATH=$GOPATH" >> $GITHUB_ENV
echo "PATH=$PATH:$GOPATH/bin" >> $GITHUB_ENV
# Optionally comment out the following lines to disable Microsoft repository if issues persist
sudo sed -i 's/^deb/# deb/' /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
# Custom step to prepare your code for the build process
- name: Prepare the Code for Build
run: make init
# Builds your React application
- name: Build React Application
env:
REACT_APP_SERVER_URL: ${{ secrets.SERVER_URL }} # Uses a secret for the server URL
run: |
echo "REACT_APP_SERVER_URL=${{ secrets.SERVER_URL }}" > .env
yarn install
yarn build
# Deploys the built site to GitHub Pages
- name: Deploy to GitHub Pages
id: deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # Specifies the deployment branch
folder: dist # Specifies the folder to deploy
clean: true # Ensures a clean deployment
# Sends a success notification to Telegram if deployment succeeds
- name: Notification for Success
if: success()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
Deployment to GitHub Pages succeeded!
Deployed to: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
# Sends a failure notification to Telegram if deployment fails
- name: Notification for Failure
if: failure()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
Deployment to GitHub Pages failed. Please check the Actions log.
Attempted Deployment URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/