Implement the sponsors section #28
This file contains hidden or 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: Deploy to Production | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "src/**" | |
| - ".github/workflows/main_deploy.yml" | |
| concurrency: | |
| group: production-deployment | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: production | |
| url: https://dotnet.cm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Generate CSS | |
| run: npm install && npm run tailwind | |
| - name: App Settings Variable Substitution | |
| uses: microsoft/variable-substitution@v1 | |
| with: | |
| files: './src/app/appsettings.Production.json' | |
| env: | |
| ConnectionStrings.SqlServer: ${{ secrets.AZURE_SQLSERVER_WEBSITE_DATABASE }} | |
| ConnectionStrings.Npgsql: ${{ secrets.AZURE_POSTGRES_WEBSITE_DATABASE }} | |
| ConnectionStrings.Sqlite: ${{ secrets.SQLITE_CONNECTION }} | |
| CookiesOptions.Issuer: ${{ secrets.COOKIES_ISSUER}} | |
| CookiesOptions.LoginPath: ${{ secrets.COOKIES_LOGINPATH}} | |
| CookiesOptions.LogoutPath: ${{ secrets.COOKIES_LOGOUTPATH}} | |
| CookiesOptions.AccessDeniedPath: ${{ secrets.COOKIES_ACCESSDENIEDPATH}} | |
| CookiesOptions.ExpirationInDays: ${{ secrets.COOKIES_EXPIRATIONINDAYS}} | |
| JwtOptions.Issuer: ${{ secrets.JWT_ISSUER}} | |
| JwtOptions.Audience: ${{ secrets.JWT_AUDIENCE}} | |
| JwtOptions.Secret: ${{ secrets.JWT_SECRET}} | |
| JwtOptions.ExpirationInMinutes: ${{ secrets.JWT_EXPIRATION_IN_MINUTES}} | |
| ApplicationInsights.InstrumentationKey: ${{ secrets.AZURE_APPINSIGHTS_INSTRUMENTAL_KEY}} | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker images | |
| run: | | |
| docker build -t djoufson/dotnetcameroon -f ./src/app/Dockerfile . | |
| docker push djoufson/dotnetcameroon:latest | |
| - name: Deploy to VPS | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.VPS_HOST }} | |
| username: ${{ secrets.VPS_USERNAME }} | |
| key: ${{ secrets.VPS_SSH_KEY }} | |
| port: ${{ secrets.VPS_PORT }} | |
| script: | | |
| cd ${{ secrets.PROJECT_PATH }} | |
| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
| docker compose -f docker-compose.prod.yml pull | |
| docker compose -f docker-compose.prod.yml up -d --force-recreate |