-
Notifications
You must be signed in to change notification settings - Fork 10
93 lines (72 loc) · 3.07 KB
/
build-and-deploy-agent.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
83
84
85
86
87
88
89
90
91
92
93
name: Build and Deploy Agent
on:
push:
branches:
- dev
tags:
- '*'
workflow_dispatch:
env:
environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
jobs:
install_and_build:
runs-on: ubuntu-latest
permissions:
id-token: write
env:
CI: false
environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install AWS CLI
run: |
sudo apt-get -q install -y python3-pip
pip3 install awscli --upgrade --user
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Remove Explorer
run: rm -rf packages/demo-explorer packages/react-components packages/vckit-oa-renderers
- name: Overwrite configuration
if: ${{ env.environment == 'dev' }}
run: cp -f packages/cli/default/default-dev.yml packages/cli/default/default.yml
- name: Create env file
if: ${{ env.environment == 'dev' }}
run: |
touch packages/encrypted-storage/.env
echo DATABASE_URL=${{ secrets.DATABASE_URL}} >> packages/encrypted-storage/.env
echo DATABASE_TYPE=postgres >> packages/encrypted-storage/.env
echo DATABASE_DATABASE=${{ secrets.DATABASE_DATABASE}} >> packages/encrypted-storage/.env
cat packages/encrypted-storage/.env
cp packages/encrypted-storage/.env packages/revocation-list-2020/.env
- name: Compress Agent Server
run: tar -czf agent-server.tar.gz *
- name: Upload Artifact to S3
run: aws s3 cp agent-server.tar.gz s3://${{ vars.AGENT_SERVER_AWS_S3_BUCKET_NAME }}/agent-server.tar.gz
deploy:
needs: install_and_build
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install AWS CLI
run: |
sudo apt-get -q install -y python3-pip
pip3 install awscli --upgrade --user
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Deploy to EC2
run: aws deploy create-deployment --application-name ${{ vars.AWS_DEPLOY_APP_NAME }} --deployment-group-name ${{ vars.AWS_DEPLOY_GROUP_NAME }} --s3-location bucket=${{ vars.AGENT_SERVER_AWS_S3_BUCKET_NAME }},key=agent-server.tar.gz,bundleType=tgz --ignore-application-stop-failures