Skip to content

ci: fix migrate

ci: fix migrate #67

Workflow file for this run

name: Build and deploy CEDAR on Azure App Services
# This action builds CEDAR on Github, then builds and deploys CEDAR on Azure App Services.
# The rebuild on Azure using ORYX is unavoidable, despite my best efforts. There are
# various documented approaches to this workflow:
#
# - https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-python.yml
# - https://github.com/Azure/actions-workflow-samples/blob/master/AppService/python-webapp-on-azure.yml
# - https://docs.github.com/en/actions/deployment/deploying-to-your-cloud-provider/deploying-to-azure/deploying-python-to-azure-app-service
#
#
on:
push:
branches:
- deploy
# workflow_dispatch enables the workflow to be triggered manually.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
jobs:
build:
name: Build CEDAR on GitHub
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Set up dependency caching for faster installs
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r requirements.txt
# Run collectstatic, as static files will be served in-app via WhiteNoise.
- name: Collect static
run: cedar_root/manage.py collectstatic
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
# upload-artifact (and download-artifact) copy files individually; we can
# zip files to improve file-handling speeds. Note, this action results in a
# double-zip when files are accessed from the web UI:
# https://github.com/actions/upload-artifact#zipped-artifact-downloads.
# Exclude 'venv/'; virtual environments are not portable.
- name: Zip artifacts
run: zip release.zip ./* -r -x 'venv/*'
- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: python-app
path: release.zip
deploy:
name: Build and Deploy on Azure
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download zip
uses: actions/download-artifact@v3
with:
name: python-app
# webapps-deploy supports zip deployment using 'package:'; we don't have
# to manually unzip.
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'cedar'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_1F0514CD2DDF442FB732476812B025B8 }}
package: release.zip
# We could also use 'startup-command:' here, rather than specifying startup.txt as a command in Azure App Services.