Skip to content

Deploy static files to Azure SWA #29

Deploy static files to Azure SWA

Deploy static files to Azure SWA #29

Workflow file for this run

name: CI
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install test dependencies
run: pip install flake8
- name: Lint code
run: flake8 --extend-ignore=E501
- name: Install app dependencies
run: pip install -r app/requirements.txt
- name: Run tests
run: python manage.py test
working-directory: app
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
run: |
IMAGE=filipmania/urlshortener
docker build -t ${IMAGE}:${GITHUB_RUN_ID} -t ${IMAGE}:latest .
docker push ${IMAGE}:${GITHUB_RUN_ID}
docker push ${IMAGE}:latest
docker build --build-arg BUILD=mssql -t ${IMAGE}:${GITHUB_RUN_ID}-mssql -t ${IMAGE}:latest-mssql .
docker push ${IMAGE}:${GITHUB_RUN_ID}-mssql
docker push ${IMAGE}:latest-mssql
docker build --build-arg BUILD=nginx -t ${IMAGE}:${GITHUB_RUN_ID}-nginx -t ${IMAGE}:latest-nginx .
docker push ${IMAGE}:${GITHUB_RUN_ID}-nginx
docker push ${IMAGE}:latest-nginx
docker build -t ${IMAGE}:nginx -f compose/Dockerfile compose
docker push ${IMAGE}:nginx
- name: Save the IMAGE_TAG
run: echo "IMAGE_TAG=${GITHUB_RUN_ID}"