Skip to content

Remove Unused Libraries, Unifying Files Naming and Update README.md Files #163

Remove Unused Libraries, Unifying Files Naming and Update README.md Files

Remove Unused Libraries, Unifying Files Naming and Update README.md Files #163

# This action deploys a draft deployment using Netlify to view changes prior to being
# merged. This does NOT deploy to production site and will only be triggered
# on changes in the specified paths below.
name: deploy-webbsite 🌐
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [develop]
paths:
- 'apps/webbsite/**'
workflow_dispatch:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_WEBBSITE_ID: ${{ secrets.NETLIFY_WEBBSITE_ID }}
jobs:
preview:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/develop' && github.event.pull_request.draft == false
strategy:
matrix:
node-version: [18.x]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Copy deployment config to root
run: cp apps/webbsite/netlify.toml netlify.toml
- name: Install dependencies
run: yarn install
- name: create env file
run: |
touch .env
echo PRIVACY_POLICY_PAGE_ID=${{ secrets.PRIVACY_POLICY_PAGE_ID }} >> .env
echo TERMS_AND_CONDITIONS_PAGE_ID=${{ secrets.TERMS_AND_CONDITIONS_PAGE_ID }} >> .env
echo NOTION_TOKEN_V2=${{ secrets.NOTION_TOKEN_V2 }} >> .env
echo NOTION_ACTIVE_USER=${{ secrets.NOTION_ACTIVE_USER }} >> .env
echo NOTION_BLOG_INTEGRATION_POSTS_DATABASE_ID=${{ secrets.NOTION_BLOG_INTEGRATION_POSTS_DATABASE_ID }} >> .env
echo NOTION_BLOG_INTEGRATION_TOKEN=${{ secrets.NOTION_BLOG_INTEGRATION_TOKEN }} >> .env
echo NOTION_BLOG_INTEGRATION_VIDEOS_DATABASE_ID=${{ secrets.NOTION_BLOG_INTEGRATION_VIDEOS_DATABASE_ID }} >> .env
- name: Install netlify-cli
run: yarn add -D -W netlify-cli
- name: Build project
run: yarn build:webbsite
- name: Deploy site
id: deploy-netlify
shell: bash
run: |
COMMAND=$(echo "npx netlify deploy --build context=deploy-preview --site $NETLIFY_WEBBSITE_ID --auth $NETLIFY_AUTH_TOKEN --dir=./dist/apps/webbsite/.next" )
OUTPUT=$(sh -c "$COMMAND")
echo "response<<EOF" >> $GITHUB_OUTPUT
echo "$OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Set variables for GH bot
id: deploy-details
shell: bash
run: |
URL=$(echo "${{ steps.deploy-netlify.outputs.response }}" | grep -Eo '(http|https)://[a-zA-Z0-9./?=_-]*(--)[a-zA-Z0-9./?=_-]*')
LOGS_URL=$(echo "${{ steps.deploy-netlify.outputs.response }}" | grep -Eo '(http|https)://app.netlify.com/[a-zA-Z0-9./?=_-]*')
echo "NETLIFY_URL=$URL" >> $GITHUB_OUTPUT
echo "NETLIFY_LOGS_URL=$LOGS_URL" >> $GITHUB_OUTPUT
- name: Netlify Preview URL
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MSG: |
<span aria-hidden="true">βœ…</span> Deploy Preview for *development webbsite* is ready! Thanks for the contribution @${{ github.actor }}
| Name | Link |
|---------------------------------|------------------------|
|<span aria-hidden="true">πŸ”¨</span> Latest commit | [${{ github.event.pull_request.head.sha }}](https://github.com/webb-tools/webb-dapp/commit/${{ github.event.pull_request.head.sha }}) |
|<span aria-hidden="true">πŸ”</span> Latest deploy log | ${{ steps.deploy-details.outputs.NETLIFY_LOGS_URL }} |
|<span aria-hidden="true">😎</span> Deploy Preview | [${{ steps.deploy-details.outputs.NETLIFY_URL }}](${{ steps.deploy-details.outputs.NETLIFY_URL }}) |
---
_To edit notification comments on pull requests, go to your [Netlify site settings](https://app.netlify.com/sites/development-webbsite/settings/deploys#deploy-notifications)._
with:
msg: ${{ env.MSG }}
check_for_duplicate_msg: false # OPTIONAL