Skip to content

chore(deps): bump django from 5.1.5 to 5.1.6 (#16) #19

chore(deps): bump django from 5.1.5 to 5.1.6 (#16)

chore(deps): bump django from 5.1.5 to 5.1.6 (#16) #19

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
tags:
# pre-release tag
- "202[5-9].[0-9][0-9].[0-9]+-rc[0-9]+"
# release tags
- "202[5-9].[0-9][0-9].[0-9]+"
defaults:
run:
shell: bash
concurrency:
# this ternary operator like expression gives us the name of the deployment environment (see https://docs.github.com/en/actions/learn-github-actions/expressions#example)
group: ${{ github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod' }}
cancel-in-progress: true
jobs:
tests-pytest:
uses: ./.github/workflows/tests-pytest.yml
permissions:
pull-requests: write
contents: write
deploy:
runs-on: ubuntu-latest
needs: [tests-pytest]
if: (!cancelled())
environment: ${{ github.ref_type != 'tag' && github.ref_name || contains(github.ref, '-rc') && 'test' || 'prod' }}
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .github/workflows/.python-version
cache: pip
cache-dependency-path: "**/pyproject.toml"
- name: Write python packages to file
run: |
python -m venv .venv
source .venv/bin/activate
pip install pipdeptree
pip install -e .
mkdir -p web/static
pipdeptree
pipdeptree >> web/static/requirements.txt
- name: Write commit SHA to file
run: echo "${{ github.sha }}" >> web/static/sha.txt
- name: Write tag to file
run: echo "${{ github.ref_name }}" >> web/static/version.txt
- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- id: repo
name: Repository name to lowercase
run: |
echo "lower=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
- name: Build, tag, and push image to GitHub Container Registry
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
build-args: GIT-SHA=${{ github.sha }}
cache-from: type=gha,scope=office-of-digital-services
cache-to: type=gha,scope=office-of-digital-services,mode=max
context: .
file: appcontainer/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.lower }}:${{ github.ref_name }}
ghcr.io/${{ steps.repo.outputs.lower }}:${{ github.sha }}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ghcr.io/${{ steps.repo.outputs.lower }}:${{ github.sha }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
release:
needs: deploy
if: ${{ github.ref_type == 'tag' && !contains(github.ref, '-rc') }}
runs-on: ubuntu-latest
permissions:
# https://github.com/softprops/action-gh-release#permissions
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release
uses: softprops/action-gh-release@v2
with:
prerelease: false
generate_release_notes: true