-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 1.98 KB
/
deploy-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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