Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testtitel #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/publishDemo.yml
Original file line number Diff line number Diff line change
@@ -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

Loading