(DEV) Deploy #9
Workflow file for this run
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 | |
# Primary ref: https://dev.to/ckgrafico/deploying-nextjs-to-azure-web-app-with-github-actions-1o9c | |
name: (DEV) Deploy | |
on: | |
push: | |
paths: | |
- frontend/** | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-and-deploy-backend: | |
name: 'Build and deploy Backend' | |
runs-on: ubuntu-latest | |
environment: Development | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@main | |
# Setup .NET Core SDK | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '7.x.x' | |
# Run dotnet build and publish | |
- name: Build | |
working-directory: backend/Api/ | |
run: | | |
dotnet restore | |
dotnet build --configuration Release | |
dotnet publish -c Release --property:PublishDir='./build' | |
# Deploy to Azure Web apps | |
- name: Deploy to App Service (NO) | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: vibes-backend-norway-dev | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_BACKEND_NO }} # Define secret variable in repository settings as per action documentation | |
package: 'backend/Api/build' | |
# Deploy to Azure Web apps | |
- name: Deploy to App Service (SE) | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: vibes-backend-sweden-dev | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_BACKEND_SE }} # Define secret variable in repository settings as per action documentation | |
package: 'backend/Api/build' | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build image | |
run: docker build frontend --tag vibes-frontend --label "runnumber=${GITHUB_RUN_ID}" | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Build and push container image to registry | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ghcr.io/${{ env.REPO }}:${{ github.ref }} | |
file: ./Dockerfile | |
deploy: | |
runs-on: ubuntu-latest | |
needs: push | |
environment: | |
name: 'production' | |
steps: | |
- name: Lowercase the repo name | |
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c | |
with: | |
app-name: frontend-docker-test-2 | |
publish-profile: ${{ secrets.TMP_DOCKER_PUSH }} | |
images: 'ghcr.io/${{ env.REPO }}:${{ github.ref }}' |