Deploy to edgio - preview #144
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy-preview | |
run-name: Deploy to edgio - preview | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy-to-edgio: | |
runs-on: ubuntu-latest | |
env: | |
EDGIO_DEPLOY_TOKEN: ${{ secrets.EDGIO_DEPLOY_TOKEN }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
EDGIO_ENVIROMENT: preview | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout | |
- uses: actions/setup-node@v4 | |
name: Setup node | |
with: | |
node-version: '18.x' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v4 | |
name: Restore yarn cache | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: | | |
yarn install | |
- name: Clone toptal templates | |
run: | | |
yarn clone-templates | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
name: Cache apt packages | |
with: | |
packages: attr | |
version: 1.0 | |
- name: Deploy to edgio | |
run: | | |
npx edgio deploy --property=gitignore --organization=profiq --environment=$EDGIO_ENVIROMENT --token=$EDGIO_DEPLOY_TOKEN --branch=$BRANCH_NAME | |
- name: Replace Slashes in Branch Name | |
run: echo "LINK_SAFE_BRANCH_NAME=$(echo $BRANCH_NAME | sed 's|/|-|g' | sed 's|\.|-|g')" >> $GITHUB_ENV | |
- uses: jwalton/gh-find-current-pr@v1 | |
id: finder | |
- name: Publish Preview Link | |
uses: marocchino/[email protected] | |
with: | |
number: ${{ steps.finder.outputs.pr }} | |
header: preview | |
message: | | |
🌐 Branch deployed as preview to: | |
https://profiq-gitignore-${{ env.LINK_SAFE_BRANCH_NAME }}.alt.free.edgio-perma.link |