Skip to content

fixing deployment

fixing deployment #24

Workflow file for this run

name: CI/CD 2022-04
on:
push:
branches:
- '2022-04-main'
- '2022-04-prod'
pull_request:
branches:
- '2022-04-main'
- '2022-04-prod'
env:
PROJECT_NAME: alpinebits-destination-data-v2022-04-server
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-v2022-04
DOCKER_TAG: ${{ github.sha }}
REF_SERVER_PORT: 8080
SERVER_PORT: 1018
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
- name: Build
run: docker-compose -f infrastructure/docker-compose.build.yml build
- name: Shut down
run: docker-compose -f infrastructure/docker-compose.build.yml down || true
deploy-test:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/2022-04-main'
needs: test
concurrency: deploy-2022-04-test
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_SERVER_PORT: ${{ env.SERVER_PORT }}
X_REF_SERVER_PORT: ${{ env.REF_SERVER_PORT }}
X_REF_SERVER_CORS_ORIGIN: "*"
X_REF_SERVER_URL: "https://destinationdata.alpinebits.opendatahub.testingmachine.eu"
X_ODH_BASE_URL: "https://tourism.api.opendatahub.com/v1/"
X_ODH_TIMEOUT: "60000"
X_AUTH_METHOD: "none"
X_REF_SERVER_EXPOSED_PORT: 8080
X_USERNAME: alpinebits
X_PASSWORD: supersecret
X_API_VERSION: 2022-04
X_SWAGGER_URL: https://swagger.opendatahub.com/?url=https://destinationdata.alpinebits.opendatahub.testingmachine.eu/specification.json
X_DB_HOSTNAME: ${{ secrets.DB_HOST_TEST }}
X_DB_HOST: ${{ secrets.DB_HOST_TEST }}
X_DB_NAME: "destinationdata"
X_DB_PORT: 5432
X_DB_EXT_PORT: 5432
X_DB_USERNAME: ${{ secrets.DB_USER_TEST }}
X_DB_PASSWORD: ${{ secrets.DB_PSWD_TEST }}
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
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 }}
deploy-prod:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/2022-04-prod'
needs: test
concurrency: deploy-2022-04-prod
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_SERVER_PORT: ${{ env.SERVER_PORT }}
X_REF_SERVER_PORT: ${{ env.REF_SERVER_PORT }}
X_REF_SERVER_CORS_ORIGIN: "*"
X_REF_SERVER_URL: "https://destinationdata.alpinebits.opendatahub.com"
X_ODH_BASE_URL: "https://tourism.api.opendatahub.com/v1/"
X_ODH_TIMEOUT: "60000"
X_AUTH_METHOD: "none"
X_REF_SERVER_EXPOSED_PORT: 8080
X_USERNAME: alpinebits
X_PASSWORD: supersecret
X_API_VERSION: 2022-04
X_SWAGGER_URL: https://swagger.opendatahub.com/?url=https://destinationdata.alpinebits.opendatahub.com/specification.json
X_DB_HOSTNAME: ${{ secrets.DB_HOST_PROD }}
X_DB_HOST: ${{ secrets.DB_HOST_PROD }}
X_DB_NAME: "destinationdata"
X_DB_PORT: 5432
X_DB_EXT_PORT: 5432
X_DB_USERNAME: ${{ secrets.DB_USER_PROD }}
X_DB_PASSWORD: ${{ secrets.DB_PSWD_PROD }}
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
hosts: 'prod'
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: 'noi-techpark-bot'
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}