Skip to content

Commit

Permalink
cfdsa
Browse files Browse the repository at this point in the history
  • Loading branch information
Izook committed Jul 8, 2023
1 parent 57eca70 commit a616b2c
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/publishDemo.yml
@@ -0,0 +1,66 @@
name: Deploy Demo

on:
workflow_call:
secrets:
AURO_SURGE_TOKEN:
required: true

jobs:
build:
runs-on: ubuntu-latest
name: Deploying Demo to Main

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Build Demo
run: |
npm ci
npm run build
- name: Update HTML Scripts
run: |
curl https://raw.githubusercontent.com/AlaskaAirlines/auro-library/main/scripts/config/useBundles.js -o useBundles.js
node useBundles.js
- name: Create Surge Domain
run: |
repo_name=$(echo ${{github.repository}} | tr / -)
branch_domain_name=$(echo ${{github.head_ref}} | tr / -)
echo "domain_name=$repo_name-$branch_domain_name.surge.sh" >> $GITHUB_ENV
- name: Deploy to Surge
run: |
npm install -g surge@0.23;
surge ./ ${{env.domain_name}} --token ${{secrets.AURO_SURGE_TOKEN}} | tee surge_output.txt
deployment_output=$(cat surge_output.txt | grep -e "Success\|Error\|Aborted" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g')
success_message="Success"
! [[ $deployment_output =~ $success_message ]] && exit 1
echo "deployment_output=$deployment_output" >> $GITHUB_ENV
- name: Format Deployment Message
run: |
npm install -g urls-md@5;
deployment_message=$(echo "${{env.deployment_output}}/demo/" | urls-md)
echo "deployment_result=$deployment_message" >> $GITHUB_ENV
- name: Comment Success to PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Surge demo deployment succeeded! 🚀🚀🚀
${{env.deployment_result}}
comment_tag: demo_comment

- name: Comment Failure to PR
uses: thollander/actions-comment-pull-request@v2
if: ${{failure()}}
with:
message: |
Surge demo deployment failed! 😭
comment_tag: demo_comment

0 comments on commit a616b2c

Please sign in to comment.