Skip to content

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

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

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

# 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-hubble-stats 🌐
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [develop]
paths:
- 'apps/hubble-stats/**'
workflow_dispatch:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_HUBBLE_STATS_ID: ${{ secrets.NETLIFY_HUBBLE_STATS_ID }} # TODO: Update this
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/hubble-stats/netlify.toml netlify.toml
- name: Install dependencies
run: yarn install
- name: Install netlify-cli
run: yarn add -D -W netlify-cli
- name: Build project
run: yarn nx build hubble-stats
- name: Deploy site
id: deploy-netlify
shell: bash
run: |
COMMAND=$(echo "npx netlify deploy --build context=deploy-preview --site $NETLIFY_HUBBLE_STATS_ID --auth $NETLIFY_AUTH_TOKEN --dir=./dist/apps/hubble-stats/.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 *webb hubble statistic* 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/webb-hubble-stats/settings/deploys#deploy-notifications)._
with:
msg: ${{ env.MSG }}
check_for_duplicate_msg: false # OPTIONAL