From 1b6e3446486294db76a0b6af801324eb6d88e539 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Nov 2024 09:13:29 +0100 Subject: [PATCH] final action --- .github/workflows/on-push-to-main.yml | 167 +++++++++++++++++++++++--- 1 file changed, 153 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml index 1db2ac6..14584e2 100644 --- a/.github/workflows/on-push-to-main.yml +++ b/.github/workflows/on-push-to-main.yml @@ -7,6 +7,8 @@ on: push: branches: - '*' # TODO - master +env: + PLATFORMS: linux/arm64 jobs: deploy: @@ -17,28 +19,60 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: '8.x' - # - name: Install dependencies - # run: npm install --prefix ./Code/src/WeatherStationProject.Dashboard.App/ClientApp install --force && dotnet restore ./Code/WeatherStationProjectDashboard.sln - # - name: Build - # run: dotnet build ./Code/WeatherStationProjectDashboard.sln - # - name: Test with the dotnet CLI - # run: dotnet test - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Get version + - name: Get dashboard version id: dashboard_version uses: KageKirin/get-csproj-version@v1 with: file: ./Code/src/WeatherStationProject.Dashboard.App/WeatherStationProject.Dashboard.App.csproj - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - # with: - # platforms: linux/arm64 + + - name: Get air parameters version + id: air_parameters_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.AirParametersService/WeatherStationProject.Dashboard.AirParametersService.csproj + + - name: Get ambient temperatures version + id: ambient_temperatures_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.AmbientTemperatureService/WeatherStationProject.Dashboard.AmbientTemperatureService.csproj + + - name: Get authentication version + id: authentication_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.AuthenticationService/WeatherStationProject.Dashboard.AuthenticationService.csproj + + - name: Get gateway version + id: gateway_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.GatewayService/WeatherStationProject.Dashboard.GatewayService.csproj + + - name: Get ground temperature version + id: ground_temperatures_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.GroundTemperatureService/WeatherStationProject.Dashboard.GroundTemperatureService.csproj + + - name: Get rainfall service version + id: rainfall_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.RainfallService/WeatherStationProject.Dashboard.RainfallService.csproj + + - name: Get wind measurements version + id: wind_measurements_version + uses: KageKirin/get-csproj-version@v1 + with: + file: ./Code/src/WeatherStationProject.Dashboard.WindMeasurementsService/WeatherStationProject.Dashboard.WindMeasurementsService.csproj + - name: Build and push Dashboard - id: push uses: docker/build-push-action@v6 with: context: . @@ -47,8 +81,113 @@ jobs: "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.App" "ENVIRONMENT_ARG=Production" file: ./Dockerfile - platforms: linux/arm64 + platforms: ${{ env.PLATFORMS }} push: true tags: | weatherstationproject/dashboard:${{ steps.dashboard_version.outputs.version }} - weatherstationproject/dashboard:latest \ No newline at end of file + weatherstationproject/dashboard:latest + + - name: Build and push air parameters service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.AirParametersService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/air-parameter-service:${{ steps.air_parameters_version.outputs.version }} + weatherstationproject/air-parameter-service:latest + + - name: Build and push ambient temperatures + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.AmbientTemperatureService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/ambient-temperature-service:${{ steps.ambient_temperatures_version.outputs.version }} + weatherstationproject/ambient-temperature-service:latest + + - name: Build and push authentication service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.AuthenticationService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/authentication-service:${{ steps.authentication_version.outputs.version }} + weatherstationproject/authentication-service:latest + + - name: Build and push gateway service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.GatewayService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/gateway-service:${{ steps.gateway_version.outputs.version }} + weatherstationproject/gateway-service:latest + + - name: Build and push ground temperature service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.GroundTemperatureService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/ground-temperature-service:${{ steps.ground_temperatures_version.outputs.version }} + weatherstationproject/ground-temperature-serviced:latest + + - name: Build and push rainfall service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.RainfallService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/rainfall-service:${{ steps.rainfall_version.outputs.version }} + weatherstationproject/rainfall-service:latest + + - name: Build and push wind measurements service + uses: docker/build-push-action@v6 + with: + context: . + build-args: | + "INCLUDE_NPM_ARG=false" + "PROJECT_NAME_ARG=WeatherStationProject.Dashboard.WindMeasurementsService" + "ENVIRONMENT_ARG=Production" + file: ./Dockerfile + platforms: ${{ env.PLATFORMS }} + push: true + tags: | + weatherstationproject/wind-measurements-service:${{ steps.wind_measurements_version.outputs.version }} + weatherstationproject/wind-measurements-service:latest \ No newline at end of file