Skip to content

Orbit Deployment 20230814 01 #119

Orbit Deployment 20230814 01

Orbit Deployment 20230814 01 #119

Workflow file for this run

# 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-faucet 🌐
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [develop]
paths:
- 'apps/faucet/**'
workflow_dispatch:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_FAUCET_ID: ${{ secrets.NETLIFY_FAUCET_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/faucet/netlify.toml netlify.toml
- name: Install dependencies
run: yarn install
- name: create env file
run: |
touch .env
echo NEXT_PUBLIC_FAUCET_BACKEND_URL=${{ secrets.NEXT_PUBLIC_FAUCET_BACKEND_URL }} >> .env
echo NEXT_PUBLIC_TWITTER_CLIENT_ID=${{ secrets.NEXT_PUBLIC_TWITTER_CLIENT_ID }} >> .env
echo TWITTER_CLIENT_SECRET=${{ secrets.TWITTER_CLIENT_SECRET }} >> .env
- name: Build project
# Fix: JavaScript heap out of memory
# https://github.com/actions/runner-images/issues/70#issuecomment-1191708172
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn build:faucet
- name: Deploy site
id: deploy-netlify
shell: bash
run: |
COMMAND=$(echo "yarn netlify deploy --build context=deploy-preview --site $NETLIFY_FAUCET_ID --auth $NETLIFY_AUTH_TOKEN --dir=./dist/apps/faucet/.next --filter=@webb-tools/faucet" )
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./?=_-]*(--webb-faucet.netlify.app)')
LOGS_URL=$(echo "${{ steps.deploy-netlify.outputs.response }}" | grep -Eo '(http|https)://app.netlify.com/sites/webb-faucet/functions[a-zA-Z0-9./?=_-]*')
echo "NETLIFY_URL=$URL" >> $GITHUB_OUTPUT
echo "NETLIFY_LOGS_URL=$LOGS_URL" >> $GITHUB_OUTPUT
- name: Netlify Preview URL
# Use master branch to fix issue with entrypoint.sh script
# https://github.com/unsplash/comment-on-pr/issues/51
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MSG: |
<span aria-hidden="true">βœ…</span> Deploy Preview for *webb faucet* 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-faucet/settings/deploys#deploy-notifications)._
with:
msg: ${{ env.MSG }}
check_for_duplicate_msg: false # OPTIONAL