Remove obsolete test files and add new API implementation with weathe… #44
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: API | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore | |
| - name: Test | |
| run: dotnet test --no-build --verbosity normal | |
| - name: dotnet publish | |
| run: dotnet publish Api\UrlShortener.Api -c Release -o ${{env.DOTNET_ROOT}}/myapp | |
| - name: Upload artifact for deployment job | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: .net-app | |
| path: ${{env.DOTNET_ROOT}}/myapp | |
| deploy-dev: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: Development | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: .net-app | |
| - name: Deploy to Azure Web App | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ vars.API_RESOURCE_NAME }} | |
| slot-name: 'production' | |
| publish-profile: ${{ secrets.AZURE_API_PUBLISH_PROFILE }} | |
| package: . |