fix edge case professors #8
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
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
# More GitHub Actions for Azure: https://github.com/Azure/actions | |
name: Build and deploy container app to Azure Web App - profstats | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/main_profstats.yml" | |
- "api/**" | |
- "db_setup/**" | |
- "raw_data/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Run create_db.py | |
run: python db_setup/create_db.py | |
- name: Run test_db.py | |
run: python db_setup/test_db.py | |
continue-on-error: false | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21.x" | |
- name: Install dependencies | |
working-directory: api | |
run: go get . | |
- name: Test with Go | |
working-directory: api | |
run: go test -v ./... | |
continue-on-error: false | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: https://profstats.azurecr.io/ | |
username: ${{ secrets.AzureAppService_ContainerUsername_50382c2ff2f34ee4bf7c325124b387fb }} | |
password: ${{ secrets.AzureAppService_ContainerPassword_6ac2726f47784a378b4cf66a20d5489b }} | |
- name: Build and push container image to registry | |
uses: docker/build-push-action@v3 | |
with: | |
context: api | |
push: true | |
tags: profstats.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_50382c2ff2f34ee4bf7c325124b387fb }}/profstats:${{ github.sha }} | |
file: api/Dockerfile | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: "production" | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: "profstats" | |
slot-name: "production" | |
publish-profile: ${{ secrets.AzureAppService_PublishProfile_022c124f26704ddcb13d6a1298cfe55b }} | |
images: "profstats.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_50382c2ff2f34ee4bf7c325124b387fb }}/profstats:${{ github.sha }}" |