Nigthly #436
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |