-
Notifications
You must be signed in to change notification settings - Fork 6
95 lines (77 loc) · 2.88 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
name: CI/CD
on:
push:
pull_request:
env:
AWS_REGION : "eu-west-1"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: clone into repo
uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: install hugo
run: sudo apt-get install hugo
- name: setup hugo
run: hugo -s src -d ../target
deploy-test:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: deploy-test
env:
AWS_S3_BUCKET_NAME : 'it.bz.opendatahub.test'
MAIL_CLIENT: 'https://mailclient.opendatahub.bz.it/contact'
HUGO_BASEURL: 'https://opendatahub.testingmachine.eu/'
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install hugo
run: sudo apt-get install hugo
- name: Configuration hugo
run: |
sed -i -e "s%https://example.com%${{env.MAIL_CLIENT}}%g" src/themes/odh-fbe/static/js/main.js
sed -i -e "s%https://example.com%${{env.HUGO_BASEURL}}%g" src/config/_default/config.yml
- name: Build hugo
run: hugo -s src -d ../target --environment testing
- 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: ./target
deploy-prod:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod'
needs: test
concurrency: deploy-prod
env:
AWS_S3_BUCKET_NAME : 'it.bz.geobank'
MAIL_CLIENT: 'https://mailclient.opendatahub.bz.it/contact'
HUGO_BASEURL: 'https://opendatahub.com/'
SCRIPTS_HOST: 'https://scripts.opendatahub.com'
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install hugo
run: sudo apt-get install hugo
- name: Configuration hugo
run: |
sed -i -e "s%https://example.com%${{env.MAIL_CLIENT}}%g" src/themes/odh-fbe/static/js/main.js
sed -i -e "s%https://example.com%${{env.HUGO_BASEURL}}%g" src/config/_default/config.yml
- name: Change scripts host to prod
run: sed -i -e "s%https://scripts.opendatahub.testingmachine.eu%${{env.SCRIPTS_HOST}}%g" src/config/_default/config.yml
- name: Build hugo
run: hugo -s src -d ../target --environment production
- 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: ./target