limited learning iteration number (#60) #45
This file contains 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 | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
SQLFLUFF_DIALECT: postgres | |
DOCKER_IMAGE: redgate/flyway | |
SCHEMAS: public | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# run tests | |
- uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: global.json | |
- name: Tests | |
run: dotnet test -c Release --logger "trx;LogFileName=test-results.trx" | |
# upload test results | |
- name: Upload dotnet test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: "**/*.trx" | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
# if tests are ok, deploy to production | |
- name: Apply migrations to production DB | |
run: >- | |
docker run --rm | |
--volume ${{ github.workspace }}/src/migrations:/flyway/sql:ro | |
--volume ${{ github.workspace }}/reports:/flyway/reports | |
"${{ env.DOCKER_IMAGE }}" | |
-url="${{ secrets.DB_PROD_URL }}" | |
-user="${{ secrets.DB_PROD_USERNAME }}" | |
-password="${{ secrets.DB_PROD_PASSWORD }}" | |
migrate -schemas="${{ env.SCHEMAS }}" | |
- name: Upload Flyway report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Database Report | |
path: reports/ | |
- name: 'Docker Login' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build the frontend image and push it to ACR | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: dotnetruacr.azurecr.io/vahter-bot-ban:${{ github.sha }}, dotnetruacr.azurecr.io/vahter-bot-ban:latest | |
file: ./Dockerfile |