Skip to content

Merge branch 'main' into prod #2270

Merge branch 'main' into prod

Merge branch 'main' into prod #2270

Workflow file for this run

name: CI/CD API
on:
push:
pull_request:
env:
PROJECT_NAME: odh-tourism-api
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-api
DOCKER_TAG: ${{ github.sha }}
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
dotnet-quality: 'preview'
- name: Restore dependencies
run: dotnet restore OdhApiCore.sln
- name: Build OdhApiCore Solution
run: dotnet build OdhApiCore.sln --no-restore
- name: Test
run: dotnet test OdhApiCore --filter Category!=Integration
deploy-test-api:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
env:
API_URL: "https://api.tourism.testingmachine.eu/v1/"
needs: test
concurrency: deploy-test-api
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
submodules: true
- 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: 1011
X_ASPNETCORE_ENVIRONMENT: "Development"
X_PG_CONNECTION: ${{ secrets.PG_CONNECTION_TEST }}
X_MSS_USER: ${{ secrets.MSS_USER_TEST }}
X_MSS_PSWD: ${{ secrets.MSS_PSWD_TEST }}
X_MSS_SERVICEURL: "https://www.easymailing.eu/mss/mss_service.php"
X_LCS_USER: ${{ secrets.LCS_USER_TEST }}
X_LCS_PSWD: ${{ secrets.LCS_PSWD_TEST }}
X_LCS_MSGPSWD: ${{ secrets.LCS_MSGPSWD_TEST }}
X_LCS_SERVICEURL: "https://lcs.lts.it/api/data.svc"
X_CDB_USER: ${{ secrets.CDB_USER_TEST }}
X_CDB_PSWD: ${{ secrets.CDB_PSWD_TEST }}
X_CDB_SERVICEURL: "https://lcs.lts.it/data/cdbdata.asmx"
X_SIAG_USER: ${{ secrets.SIAG_USER_TEST }}
X_SIAG_PSWD: ${{ secrets.SIAG_PSWD_TEST }}
X_SIAG_SERVICEURL: "http://daten.buergernetz.bz.it/services/weather/"
X_XMLDIR: ${{ secrets.XMLDIR_TEST }}
X_IMG_URL: "https://images.tourism.testingmachine.eu/api/Image/GetImage?imageurl="
X_DOC_URL: "https://images.tourism.testingmachine.eu/api/File/GetFile/"
X_S3_BUCKET_ACCESSPOINT: ${{ secrets.S3_BUCKET_ACCESSPOINT_TEST }}
X_S3_IMAGEUPLOADER_ACCESSKEY: ${{ secrets.S3_IMAGEUPLOADER_ACCESSKEY_TEST }}
X_S3_IMAGEUPLOADER_SECRETKEY: ${{ secrets.S3_IMAGEUPLOADER_SECRETKEY_TEST }}
X_OAUTH_AUTORITY: "https://auth.opendatahub.testingmachine.eu/auth/realms/noi/"
X_ELK_URL: ${{ secrets.ELK_URL_TEST }}
X_ELK_TOKEN: ${{ secrets.ELK_TOKEN_TEST }}
X_JSONPATH: "./wwwroot/json/"
X_EBMS_USER: ${{ secrets.EBMS_USER_TEST }}
X_EBMS_PASS: ${{ secrets.EBMS_PASS_TEST }}
X_EBMS_SERVICEURL: ${{ secrets.EBMS_URL_TEST }}
X_DSS_SERVICEURL: "https://www.dolomitisuperski.com/jsonexport/export/"
X_DSS_USER: ${{ secrets.DSS_USER_TEST }}
X_DSS_PSWD: ${{ secrets.DSS_PSWD_TEST }}
X_A22_USER: ${{ secrets.A22_USER_TEST }}
X_A22_PSWD: ${{ secrets.A22_PSWD_TEST }}
X_A22_SERVICEURL: ${{ secrets.A22_URL_TEST }}
X_FERATEL_USER: ""
X_FERATEL_PSWD: ""
X_FERATEL_SERVICEURL: ${{ secrets.FERATEL_URL_TEST }}
X_PANOMAX_USER: ""
X_PANOMAX_PSWD: ""
X_PANOMAX_SERVICEURL: ${{ secrets.PANOMAX_URL_TEST }}
X_PANOCLOUD_USER: ""
X_PANOCLOUD_PSWD: ""
X_PANOCLOUD_SERVICEURL: ${{ secrets.PANOCLOUD_URL_TEST }}
X_LOOPTEC_USER: ""
X_LOOPTEC_PSWD: ""
X_LOOPTEC_SERVICEURL: ${{ secrets.LOOPTEC_URL_TEST }}
X_SUEDTIROLWEIN_USER: ""
X_SUEDTIROLWEIN_PSWD: ""
X_SUEDTIROLWEIN_SERVICEURL: "https://suedtirolwein.secure.consisto.net/"
X_MUSPORT_USER: ""
X_MUSPORT_PSWD: ""
X_MUSPORT_SERVICEURL: "https://musport.prov.bz.it/musport/services/MuseumsService/"
X_NINJA_USER: ""
X_NINJA_PSWD: ""
X_NINJA_SERVICEURL: "https://mobility.api.opendatahub.com/v2/flat/"
X_DATABROWSER_URL: "https://frontend.tourism.testingmachine.eu/"
X_RAVEN_SERVICEURL: "https://service.suedtirol.info/api/"
X_RAVEN_USER: ${{ secrets.RAVEN_USER_TEST }}
X_RAVEN_PSWD: ${{ secrets.RAVEN_PSWD_TEST }}
X_API_URL: ${{ env.API_URL }}
X_NOICOMMUNITY_SERVERKEY: ${{ secrets.NOICOMMUNITY_SERVERKEY_TEST }}
X_NOICOMMUNITY_SENDERID: ${{ secrets.NOICOMMUNITY_SENDERID_TEST }}
X_NOICOMMUNITY_PROJECTNAME: "noi-community"
X_NOICOMMUNITY_FCMSERVICEACCOUNT: "google-service-account.noicommunity.json"
X_S3_WEATHERFORECAST_FILENAME: "SMOS_MCPL-WX_EXP_SIAG.JSON"
X_S3_WEATHERFORECAST_ACCESSKEY: ${{ secrets.S3_WEATHERFORECAST_ACCESSKEY }}
X_S3_WEATHERFORECAST_SECRET: ${{ secrets.S3_WEATHERFORECAST_SECRET }}
X_MARKETPLACE_PUSH_URL: ""
X_MARKETPLACE_PUSH_USER: ""
X_MARKETPLACE_PUSH_PSWD: ""
X_LTSAPI_IDM_XLTSCLIENTID: ""
X_LTSAPI_IDM_SERVICEURL: ""
X_LTSAPI_IDM_USERNAME: ""
X_LTSAPI_IDM_PASSWORD: ""
X_LTSAPI_IDM_OPENDATA: false
- name: Setup config
run: |
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_NOICOMMUNITY }}" > google-service-account.noicommunity.json
chmod +r google-service-account.noicommunity.json
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
working-directory: OdhApiCore
docker-compose-file: docker-compose.yml
- 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 }}
- name: Generate Json
run: |
curl "${{ env.API_URL }}STA/JsonPoi"
curl "${{ env.API_URL }}STA/JsonAccommodation"
curl "${{ env.API_URL }}ODH/AccommodationBooklist"
curl "${{ env.API_URL }}ODH/AccommodationFulllist"
curl "${{ env.API_URL }}ODH/Taglist"
curl "${{ env.API_URL }}ODH/OdhTagAutoPublishlist"
curl "${{ env.API_URL }}ODH/OdhTagCategorieslist"
curl "${{ env.API_URL }}ODH/WeatherForecast"
deploy-prod-api:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod'
env:
API_URL: "https://tourism.api.opendatahub.com/v1/"
needs: test
concurrency: deploy-prod-api
steps:
- name: Checkout source code
uses: actions/checkout@v2
with:
submodules: true
- 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: 1011
X_ASPNETCORE_ENVIRONMENT: "Production"
X_PG_CONNECTION: ${{ secrets.PG_CONNECTION_PROD }}
X_MSS_USER: ${{ secrets.MSS_USER_TEST }}
X_MSS_PSWD: ${{ secrets.MSS_PSWD_TEST }}
X_MSS_SERVICEURL: "https://www.easymailing.eu/mss/mss_service.php"
X_LCS_USER: ${{ secrets.LCS_USER_TEST }}
X_LCS_PSWD: ${{ secrets.LCS_PSWD_TEST }}
X_LCS_MSGPSWD: ${{ secrets.LCS_MSGPSWD_TEST }}
X_LCS_SERVICEURL: "https://lcs.lts.it/api/data.svc"
X_CDB_USER: ${{ secrets.CDB_USER_TEST }}
X_CDB_PSWD: ${{ secrets.CDB_PSWD_TEST }}
X_CDB_SERVICEURL: "https://lcs.lts.it/data/cdbdata.asmx"
X_SIAG_USER: ${{ secrets.SIAG_USER_TEST }}
X_SIAG_PSWD: "http://daten.buergernetz.bz.it/services/weather/"
X_SIAG_SERVICEURL: ${{ secrets.SIAG_URL_TEST }}
X_XMLDIR: ${{ secrets.XMLDIR_TEST }}
X_IMG_URL: "https://tourism.images.opendatahub.com/api/Image/GetImage?imageurl="
X_DOC_URL: "https://tourism.images.opendatahub.com/api/File/GetFile/"
X_S3_BUCKET_ACCESSPOINT: ${{ secrets.S3_BUCKET_ACCESSPOINT_TEST }}
X_S3_IMAGEUPLOADER_ACCESSKEY: ${{ secrets.S3_IMAGEUPLOADER_ACCESSKEY_TEST }}
X_S3_IMAGEUPLOADER_SECRETKEY: ${{ secrets.S3_IMAGEUPLOADER_SECRETKEY_TEST }}
X_OAUTH_AUTORITY: "https://auth.opendatahub.com/auth/realms/noi/"
X_ELK_URL: ${{ secrets.ELK_URL_TEST }}
X_ELK_TOKEN: ${{ secrets.ELK_TOKEN_TEST }}
X_JSONPATH: "./wwwroot/json/"
X_EBMS_USER: ${{ secrets.EBMS_USER_TEST }}
X_EBMS_PASS: ${{ secrets.EBMS_PASS_TEST }}
X_EBMS_SERVICEURL: ${{ secrets.EBMS_URL_TEST }}
X_DSS_SERVICEURL: "https://www.dolomitisuperski.com/jsonexport/export/"
X_DSS_USER: ${{ secrets.DSS_USER_TEST }}
X_DSS_PSWD: ${{ secrets.DSS_PSWD_TEST }}
X_A22_USER: ${{ secrets.A22_USER_TEST }}
X_A22_PSWD: ${{ secrets.A22_PSWD_TEST }}
X_A22_SERVICEURL: ${{ secrets.A22_URL_TEST }}
X_FERATEL_USER: ""
X_FERATEL_PSWD: ""
X_FERATEL_SERVICEURL: ${{ secrets.FERATEL_URL_TEST }}
X_PANOMAX_USER: ""
X_PANOMAX_PSWD: ""
X_PANOMAX_SERVICEURL: ${{ secrets.PANOMAX_URL_TEST }}
X_PANOCLOUD_USER: ""
X_PANOCLOUD_PSWD: ""
X_PANOCLOUD_SERVICEURL: ${{ secrets.PANOCLOUD_URL_TEST }}
X_LOOPTEC_USER: ""
X_LOOPTEC_PSWD: ""
X_LOOPTEC_SERVICEURL: ${{ secrets.LOOPTEC_URL_TEST }}
X_SUEDTIROLWEIN_USER: ""
X_SUEDTIROLWEIN_PSWD: ""
X_SUEDTIROLWEIN_SERVICEURL: "https://suedtirolwein.secure.consisto.net/"
X_MUSPORT_USER: ""
X_MUSPORT_PSWD: ""
X_MUSPORT_SERVICEURL: "https://musport.prov.bz.it/musport/services/MuseumsService/"
X_NINJA_USER: ""
X_NINJA_PSWD: ""
X_NINJA_SERVICEURL: "https://mobility.api.opendatahub.com/v2/flat/"
X_DATABROWSER_URL: "https://databrowser.opendatahub.com/"
X_RAVEN_SERVICEURL: "https://service.suedtirol.info/api/"
X_RAVEN_USER: ${{ secrets.RAVEN_USER_TEST }}
X_RAVEN_PSWD: ${{ secrets.RAVEN_PSWD_TEST }}
X_API_URL: ${{ env.API_URL }}
X_NOICOMMUNITY_SERVERKEY: ${{ secrets.NOICOMMUNITY_SERVERKEY_TEST }}
X_NOICOMMUNITY_SENDERID: ${{ secrets.NOICOMMUNITY_SENDERID_TEST }}
X_NOICOMMUNITY_PROJECTNAME: "noi-community"
X_NOICOMMUNITY_FCMSERVICEACCOUNT: "google-service-account.noicommunity.json"
X_S3_WEATHERFORECAST_FILENAME: "SMOS_MCPL-WX_EXP_SIAG.JSON"
X_S3_WEATHERFORECAST_ACCESSKEY: ${{ secrets.S3_WEATHERFORECAST_ACCESSKEY }}
X_S3_WEATHERFORECAST_SECRET: ${{ secrets.S3_WEATHERFORECAST_SECRET }}
X_MARKETPLACE_PUSH_URL: ${{ secrets.IDM_MARKETPLACE_PUSH_PROD_URL }}
X_MARKETPLACE_PUSH_USER: ${{ secrets.IDM_MARKETPLACE_PUSH_PROD_USERNAME }}
X_MARKETPLACE_PUSH_PSWD: ${{ secrets.IDM_MARKETPLACE_PUSH_PROD_PASSWORD }}
X_LTSAPI_IDM_XLTSCLIENTID: ""
X_LTSAPI_IDM_SERVICEURL: ""
X_LTSAPI_IDM_USERNAME: ""
X_LTSAPI_IDM_PASSWORD: ""
X_LTSAPI_IDM_OPENDATA: false
- name: Setup config
run: |
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_NOICOMMUNITY }}" > google-service-account.noicommunity.json
chmod +r google-service-account.noicommunity.json
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
working-directory: OdhApiCore
docker-compose-file: docker-compose.yml
- 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 }}
- name: Generate Json
run: |
curl "${{ env.API_URL }}STA/JsonPoi"
curl "${{ env.API_URL }}STA/JsonAccommodation"
curl "${{ env.API_URL }}ODH/AccommodationBooklist"
curl "${{ env.API_URL }}ODH/AccommodationFulllist"
curl "${{ env.API_URL }}ODH/Taglist"
curl "${{ env.API_URL }}ODH/OdhTagAutoPublishlist"
curl "${{ env.API_URL }}ODH/OdhTagCategorieslist"
curl "${{ env.API_URL }}ODH/WeatherForecast"