-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (112 loc) · 4.65 KB
/
main.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI/CD
on:
push:
pull_request:
env:
AWS_REGION : "eu-west-1"
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}
DOCKER_TAG: ${{ github.sha }}
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: clone into repo
uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: Test
run: |
cd src/main/webapp
test -f index.html
test -f dotenv.js
deploy-test:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: deploy-test
env:
AWS_S3_BUCKET_NAME : 'odh.analytics-test'
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_ENDPOINT_URL: "https://analytics.opendatahub.testingmachine.eu"
X_THUNDERFOREST_MAP_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }}
X_ODH_MOBILITY_API_URI: "https://mobility.api.opendatahub.testingmachine.eu/v2"
X_KEYCLOAK_AUTHORIZATION_URI: "https://auth.opendatahub.testingmachine.eu/auth"
X_KEYCLOAK_REALM: "noi"
X_KEYCLOAK_CLIENT_ID: "odh-mobility-analytics"
X_KEYCLOAK_REDIRECT_URI: "https://analytics.opendatahub.testingmachine.eu/"
X_KEYCLOAK_SILENT_CHECK_SSO_REDIRECT_URI: "https://analytics.opendatahub.testingmachine.eu/callback.html"
- name: Run dotenv-sed.sh
run: cd infrastructure && ./dotenv-sed.sh
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./src/main/webapp
deploy-prod:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/prod'
needs: test
concurrency: deploy-prod
env:
AWS_S3_BUCKET_NAME : 'odh.analytics-prod'
SCRIPTS_HOST: 'https://scripts.opendatahub.com'
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_ENDPOINT_URL: "https://analytics.opendatahub.com"
X_THUNDERFOREST_MAP_API_KEY: ${{ secrets.THUNDERFOREST_API_KEY }}
X_ODH_MOBILITY_API_URI: "https://mobility.api.opendatahub.com/v2"
X_KEYCLOAK_AUTHORIZATION_URI: "https://auth.opendatahub.com/auth"
X_KEYCLOAK_REALM: "noi"
X_KEYCLOAK_CLIENT_ID: "odh-mobility-analytics"
X_KEYCLOAK_REDIRECT_URI: "https://analytics.opendatahub.com/"
X_KEYCLOAK_SILENT_CHECK_SSO_REDIRECT_URI: "https://analytics.opendatahub.com/callback.html"
- name: Change scripts host to prod
run: sed -i -e "s%https://scripts.opendatahub.testingmachine.eu%${{env.SCRIPTS_HOST}}%g" src/main/webapp/index.html
- name: Run dotenv-sed.sh
run: cd infrastructure && ./dotenv-sed.sh
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./src/main/webapp
docker-image:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: docker-image
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_ENDPOINT_URL: "https://analytics.dev.testingmachine.eu"
X_ODH_MOBILITY_API_URI: "https://mobility.api.dev.testingmachine.eu"
X_KEYCLOAK_AUTHORIZATION_URI: "https://auth.opendatahub.testingmachine.eu/auth"
X_KEYCLOAK_REALM: "noi"
X_KEYCLOAK_CLIENT_ID: "odh-mobility-analytics"
X_KEYCLOAK_REDIRECT_URI: "https://analytics.dev.testingmachine.eu"
X_KEYCLOAK_SILENT_CHECK_SSO_REDIRECT_URI: https://analytics.dev.testingmachine.eu/callback.html"
- name: Run dotenv-sed.sh
run: cd infrastructure && ./dotenv-sed.sh
# Docker image for Kubernetes
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}