-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 3.06 KB
/
nightly.yaml
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
name: Nigthly
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: private-2
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PREFIX: ${{ secrets.DOCKER_PREFIX }}
IONOS_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
IONOS_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
IONOS_BUCKET: iff-env
IONOS_FILE_KEY: factory50/dev/.env.development
IONOS_ENDPOINT: https://s3-eu-central-1.ionoscloud.com
outputs:
DOCKER_TAG: ${{ steps.build.outputs.NIGHTLY_DOCKER_TAG }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Use the version of Python you need
- name: Install boto3
run: pip install boto3
- name: Fetch .env.development from IONOS S3
run: python utils/fetch_env.py
- name: Verify .env.development
run: |
cat frontend/.env.development
- id: build
name: Build & Push Image
shell: bash
run: |
export DOCKER_TAG="latest"
NIGHTLY_DOCKER_TAG=nightly-`date -I`-`date +%s`
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
docker compose build
docker tag ${DOCKER_PREFIX}/factory50-backend:${DOCKER_TAG} ${DOCKER_PREFIX}/factory50-backend:${NIGHTLY_DOCKER_TAG}
docker tag ${DOCKER_PREFIX}/factory50-frontend:${DOCKER_TAG} ${DOCKER_PREFIX}/factory50-frontend:${NIGHTLY_DOCKER_TAG}
docker push ${DOCKER_PREFIX}/factory50-backend:${DOCKER_TAG}
docker push ${DOCKER_PREFIX}/factory50-backend:${NIGHTLY_DOCKER_TAG}
docker push ${DOCKER_PREFIX}/factory50-frontend:${DOCKER_TAG}
docker push ${DOCKER_PREFIX}/factory50-frontend:${NIGHTLY_DOCKER_TAG}
docker rmi ${DOCKER_PREFIX}/factory50-backend:${DOCKER_TAG}
docker rmi ${DOCKER_PREFIX}/factory50-backend:${NIGHTLY_DOCKER_TAG}
docker rmi ${DOCKER_PREFIX}/factory50-frontend:${DOCKER_TAG}
docker rmi ${DOCKER_PREFIX}/factory50-frontend:${NIGHTLY_DOCKER_TAG}
echo "NIGHTLY_DOCKER_TAG=${NIGHTLY_DOCKER_TAG}" >> "${GITHUB_OUTPUT}"
- name: Cleanup .env.development
run: |
rm frontend/.env.development
deploy:
needs: build
uses: IndustryFusion/GitOpsRepo/.github/workflows/deploy.yaml@main
with:
APPS: factory50
NAMESPACE: iff50
DOCKER_TAG: ${{ needs.build.outputs.DOCKER_TAG }}
CLUSTER: IFF-Dev-SmartFactory
secrets:
PRIVATE_GITHUB_TOKEN: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
HUB_TOKEN: ${{ secrets.HUB_TOKEN }}
GATEWAY_TOKEN: ${{ secrets.GATEWAY_TOKEN }}
ALERTA_KEY_DEV: ${{ secrets.ALERTA_KEY_DEV }}
FACTORY_MONGO_URL_DEV: ${{ secrets.FACTORY_MONGO_URL_DEV }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}