-
Notifications
You must be signed in to change notification settings - Fork 21
82 lines (67 loc) · 2.5 KB
/
codepreview.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
72
73
74
75
76
77
78
79
80
81
82
name: Create preview environment
on:
pull_request:
branches: [main, milkomeda-c1-testnet]
push:
branches: [main, milkomeda-c1-testnet]
concurrency:
# The preview script can't handle concurrent deploys
group: codepreview
cancel-in-progress: false
# TODO: Define minimal permissions, I haven't found which one is necessary to allow writing comments on commits
# see https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
#permissions:
# contents: read # for checkout
jobs:
preview:
runs-on: ubuntu-latest
steps:
- name: Install ansible
run: python3 -m pip install --user ansible
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- name: Install dependencies
run: npm ci
# CI=false disables reporting warnings as errors
- name: Prepare build (pr)
if: ${{ (github.head_ref || github.ref_name) != 'main' }}
run: CI=false npm run build:milkomeda-c1-testnet
# CI=false disables reporting warnings as errors
- name: Prepare build (pr)
if: ${{ (github.head_ref || github.ref_name) != 'main' }}
run: CI=false npm run build:sepolia-testnet
# CI=false disables reporting warnings as errors
- name: Prepare build (pr)
if: ${{ (github.head_ref || github.ref_name) != 'main' }}
run: CI=false npm run build:ethereum-classic-mordor
# CI=false disables reporting warnings as errors
- name: Prepare build (main)
if: ${{ (github.head_ref || github.ref_name) == 'main' }}
run: CI=false npm run build:milkomeda-c1
- name: Create SSH key
run: |
mkdir -p ~/.ssh/
echo "$CODEPREVIEW_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking=no" > ~/.ssh/config
shell: bash
env:
CODEPREVIEW_PRIVATE_KEY: ${{secrets.CODEPREVIEW_PRIVATE_KEY}}
- name: Create codepreview scripts
run: |
rm -rf ./infra
curl -u "github:$CODEPREVIEW_TOKEN" -O https://djed.codepreview.io/djed.zip
unzip djed.zip -d .
chmod +x ./infra/scripts/*.sh
shell: bash
env:
CODEPREVIEW_TOKEN: ${{secrets.CODEPREVIEW_TOKEN}}
- name: Create preview env
run: cd infra && ./scripts/deploy-preview.sh
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_NUMBER: ${{ github.event.number }}