-
Notifications
You must be signed in to change notification settings - Fork 47
60 lines (49 loc) · 2.22 KB
/
pr-review.yaml
File metadata and controls
60 lines (49 loc) · 2.22 KB
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
name: PR deploy
on:
pull_request:
types: [review_requested]
branches:
- "*"
pull_request_review:
types: [submitted]
jobs:
build:
if: github.event_name == 'pull_request' || github.event.review.state == 'approved'
runs-on: self-hosted
steps:
# Step 1: Checkout the code from the PR branch
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up environment variables for container names
- name: Set container names
run: |
echo "WEB_CONNECT_CONTAINER_NAME=web-connect-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "WEB_STAKING_CONTAINER_NAME=web-staking-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
# Step 3: Build web-connect and web-staking services using docker compose
- name: Build Docker web-staking
run: |
docker compose -f .dev-deploy/docker-compose.yml build web-staking
- name: Build Docker web-connect
run: |
docker compose -f .dev-deploy/docker-compose.yml build web-connect
- name: Check if containers exist and remove them
run: |
# Check if the web-connect container exists, and remove it if it does
if [ "$(docker ps -a -q -f name=${{ env.WEB_CONNECT_CONTAINER_NAME }})" ]; then
docker stop ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
docker rm ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
fi
# Check if the web-staking container exists, and remove it if it does
if [ "$(docker ps -a -q -f name=${{ env.WEB_STAKING_CONTAINER_NAME }})" ]; then
docker stop ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
docker rm ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
fi
- name: Run web-connect container
run: |
docker compose -f .dev-deploy/docker-compose.yml run -d --name ${{ env.WEB_CONNECT_CONTAINER_NAME }} web-connect
- name: Run web-staking container
run: |
docker compose -f .dev-deploy/docker-compose.yml run -d --name ${{ env.WEB_STAKING_CONTAINER_NAME }} \
-e NEXT_PUBLIC_APP_ENV=development \
-e MONGODB_URL=${{ secrets.MONGODB_URL }} \
web-staking