-
Notifications
You must be signed in to change notification settings - Fork 37
68 lines (66 loc) · 2.12 KB
/
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
name: Portal Bridge [Preview]
on:
pull_request:
# paths:
# - '!apps/token-list/**'
jobs:
branch-sha:
name: Compute Branch Sha
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-preview-sha
outputs:
value: ${{ steps.set-version.outputs._BRANCH_NAME_SHA }}
steps:
- name: Set Version
id: set-version
run: echo "_BRANCH_NAME_SHA=$(echo ${{ github.event.pull_request.head.ref }} | sha256sum | cut -c -10)" >> "${GITHUB_OUTPUT}"
build:
name: "Build Preview"
uses: ./.github/workflows/build.yml
with:
name: preview
separator: P
advanced-tools-branch: advanced-tools
environment: Cloudflare-Preview
public-url: "/${{ needs.branch-sha.outputs.value }}"
wac-url: "https://wac.gfx.xyz"
project-branch: ${{ github.event.pull_request.head.ref }}
app-domain: preview.portalbridge.com
secrets: inherit
needs:
- branch-sha
deploy:
name: "Deploy Preview"
needs:
- build
- branch-sha
runs-on: "ubuntu-latest"
concurrency:
group: ${{ github.ref }}-deploy-preview
cancel-in-progress: true
permissions:
contents: write
environment: Cloudflare-Preview
steps:
- name: Checkout preview branch
uses: actions/checkout@v3
with:
ref: preview
- name: Setup Git
run: |
git config user.name "xLabs CI"
git config user.email "devops@xlabs.xyz"
- name: Trigger a preview Deploy
run: |
sleep 30s
mkdir -p preview/${{ needs.branch-sha.outputs.value }}
pushd preview/${{ needs.branch-sha.outputs.value }}
[[ ! -f .latest ]] && touch .latest
[[ ! -f .artifacts ]] && touch .artifacts
cat .latest >> .artifacts
echo ${{ needs.build.outputs.pkg-version }} > .latest
git add .artifacts .latest
git commit -m"Update preview artifacts ${{ needs.build.outputs.pkg-version }}"
git push
echo "The preview URL is: ${{ vars.PREVIEW_ROOT_URL }}/${{ needs.branch-sha.outputs.value }}/" >> ${GITHUB_STEP_SUMMARY}