9ce2a5b56f
* Rename "azure.yml" to Node-specific name * Add templates and properties for other languages * Add workflow for .NET Core * Add workflow and properties file for PHP * Updates from PR review * Fix EOF * Use latest versions * Renamed the file appropriately. Co-authored-by: Jason Freeberg <jafreebe@microsoft.com>
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
# 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 a container to an Azure Web App
|
|
|
|
env:
|
|
AZURE_WEBAPP_NAME: '' # set this to the name of your Azure Web App
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- $default-branch
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Log in to GitHub container registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Lowercase the repo name
|
|
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
|
|
|
|
- name: Build and push container image to registry
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }}
|
|
file: ./Dockerfile
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
environment:
|
|
name: 'Development'
|
|
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
|
|
|
|
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@v2
|
|
with:
|
|
app-name: ${{ env.AZURE_WEBAPP_NAME }}
|
|
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
|
images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}'
|