Skip to content

Merge branch 'main' into prod #101

Merge branch 'main' into prod

Merge branch 'main' into prod #101

Workflow file for this run

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 }}