Skip to content

Update version numbers #6

Update version numbers

Update version numbers #6

Workflow file for this run

name: Build and deploy workers and webapp app to Azure Web App - ccom
on:
push:
branches:
- refactor/639/update-environment-workflows
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './app/workers'
PYTHON_VERSION: '3.8'
jobs:
build-and-publish-workers:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Install Poetry'
uses: snok/install-poetry@v1
- name: 'Resolve Project Dependencies Using Poetry'
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
poetry config virtualenvs.create false
poetry export --format requirements.txt --output requirements.txt
popd
shell: bash
- name: 'Install Dependencies Using Pip'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
python -m pip install --upgrade pip
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
popd
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: functionsapp
path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
build-and-publish-web:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ccomreg.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME_DEV }}
password: ${{ secrets.REGISTRY_PASSWORD_DEV }}
- name: Build and push container image to registry
uses: docker/build-push-action@v5
with:
push: true
tags: ccomreg.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}
file: ./app/Dockerfile.deploy
# Deploy Workers Dev
deploy-workers-dev:
runs-on: ubuntu-latest
needs: [build-and-publish-workers, build-and-publish-web]
# environment: dev
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
path: functionsapp
name: functionsapp
- name: 'Run Azure Functions Action'
uses: Azure/[email protected]
id: fa
with:
app-name: 'ccom-funcs-dev'
slot-name: 'production'
package: ${{ github.workspace }}/functionsapp
# TODO: Change these back after testing
# publish-profile: ${{ env.AZURE_FUNCAPP_PUBLISH_PROFILE }}
publish-profile: ${{ secrets.AZURE_FUNCAPP_PUBLISH_PROFILE }}
# Deploy Workers Test
# deploy-workers-test:
# runs-on: ubuntu-latest
# needs: deploy-workers-dev
# environment: test
# steps:
# - name: Download artifact from build job
# uses: actions/download-artifact@v4
# with:
# path: functionsapp
# name: functionsapp
# - name: 'Run Azure webapp deploy action using publish profile credentials'
# uses: azure/webapps-deploy@v2
# with:
# app-name: ${{ env.AZURE_WEBAPP_FUNCTIONS_NAME }}
# publish-profile: ${{ env.AZURE_FUNCAPP_PUBLISH_PROFILE }}
# package: ${{ github.workspace }}/functionsapp
# # Deploy Workers Prod
# deploy-workers-prod:
# runs-on: ubuntu-latest
# needs: deploy-workers-test
# environment: prod
# steps:
# - name: Download artifact from build job
# uses: actions/download-artifact@v4
# with:
# path: functionsapp
# name: functionsapp
# - name: 'Run Azure webapp deploy action using publish profile credentials'
# uses: azure/webapps-deploy@v2
# with:
# app-name: ${{ env.AZURE_WEBAPP_FUNCTIONS_NAME }}
# publish-profile: ${{ env.AZURE_FUNCAPP_PUBLISH_PROFILE }}
# package: ${{ github.workspace }}/functionsapp
# Deploy Web App Dev
deploy-web-dev:
runs-on: ubuntu-latest
needs: [build-and-publish-web, deploy-workers-dev]
# environment:
# name: 'dev'
# 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: 'ccom-dev'
# TODO: Change these back after testing
# publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
# images: 'ccomregprod.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }}
images: 'ccomregprod.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}'
# Deploy Web App Test
# deploy-web-test:
# runs-on: ubuntu-latest
# needs: [deploy-web-dev, deploy-workers-test]
# environment:
# name: 'test'
# 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: 'ccom-test'
# publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
# images: 'ccomregprod.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}'
# # Deploy Web App Prod
# deploy-web-prod:
# runs-on: ubuntu-latest
# needs: [deploy-web-test, deploy-workers-prod]
# environment:
# name: 'prod'
# 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: 'ccom'
# slot-name: 'production'
# publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }}
# images: 'ccomregprod.azurecr.io/${{ secrets.REGISTRY_USERNAME_DEV }}/latest:${{ github.sha }}'