-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (69 loc) · 2.86 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
name: CI/CD
on:
push:
pull_request:
env:
PROJECT_NAME: sfscon-backend
jobs:
deploy-test:
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
concurrency: deploy-test
env:
SERVER_PORT_CONFERENCES: 1005
SERVER_PORT_PUSH_NOTIFICATIONS: 1006
DOCKER_TAG: ${{ github.sha }}-test
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/sfscon-backend-test
DOCKER_IMAGE_WEBSERVER: ghcr.io/${{ github.repository }}/sfscon-backend-webserver-test
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
X_SERVER_PORT_CONFERENCES: ${{ env.SERVER_PORT_CONFERENCES }}
X_SERVER_PORT_PUSH_NOTIFICATIONS: ${{ env.SERVER_PORT_PUSH_NOTIFICATIONS }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE}}
X_DOCKER_IMAGE_WEBSERVER: ${{ env.DOCKER_IMAGE_WEBSERVER }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DB_HOST: postgres
X_DB_PORT: 5432
X_JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY}}
X_DB_USERNAME: ${{ secrets.DB_USERNAME }}
X_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
X_DB_NAME: ${{ secrets.DB_NAME }}
X_ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }}
X_ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }}
X_PRETIX_TOKEN: ${{ secrets.PRETIX_TOKEN }}
X_PRETIX_CHECKLIST_ID: 313919
X_PRETIX_EVENT_ID: sfscon24
X_PRETIX_ORGANIZER_ID: noi-digital
X_LANE_USERNAME_PREFIX: ${{ secrets.ADMIN_USERNAME }}
X_XML_URL: "https://www.sfscon.it/?calendar=2024&format=xml"
X_REDIS_SERVER: redis
- name: Create .aws.credentials file and inject values
env:
AWS_KEY_ID_TEST: ${{ secrets.AWS_KEY_ID_TEST }}
AWS_ACCESS_KEY_TEST: ${{ secrets.AWS_ACCESS_KEY_TEST }}
run: |
cp aws.credentials.example .aws.credentials
sed -i -e "s/KEY_ID/$AWS_KEY_ID_TEST/" .aws.credentials
sed -i -e "s/ACCESS_KEY/$AWS_ACCESS_KEY_TEST/" .aws.credentials
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
working-directory: infrastructure/ansible
hosts: "test"
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: "noi-techpark-bot"
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}