-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (51 loc) · 1.96 KB
/
share-preview-url.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
name: share-preview-url
on:
pull_request:
types:
- opened
- ready_for_review
jobs:
comment-on-pr:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: checkout code
uses: actions/checkout@v4
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: install sst
run: |
curl -fsSL https://ion.sst.dev/install | VERSION=0.1.51 bash
- name: retrieve sst app url
id: get_app_url
working-directory: ./previews
run: |
BRANCH_NAME=${{ github.event.pull_request.head.ref }}
SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g')
echo "SS_STAGE=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- name: get dest dir for web smart-camera-web
id: get_dest_dir_smart_camera_web
working-directory: ./packages/smart-camera-web
run: >-
echo "DEST_DIR_SMART_CAMERA_WEB=js/preview-$GITHUB_HEAD_REF" >>
"$GITHUB_ENV"
- name: get dest dir for web embed
id: get_dest_dir_embed
working-directory: ./packages/embed
run: echo "DEST_DIR_EMBED=inline/preview-$GITHUB_HEAD_REF" >> "$GITHUB_ENV"
- name: share preview urls as PR comment
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
msg: >
This branch has been deployed to s3 / cloudfront.
✅ Preview URL for Smart Camera Web:
https://cdn.smileidentity.com/${{ env.DEST_DIR_SMART_CAMERA_WEB }}/smart-camera-web.js
✅ Preview URL for Embed:
https://cdn.smileidentity.com/${{ env.DEST_DIR_EMBED }}/js/script.min.js
✅ Preview URL for Web Client:
${{ steps.get_app_url.outputs.PREVIEW_APP_URL }}