initial NearBeach

This commit is contained in:
2026-10-28 21:00:21 -04:00
parent 3d61b05194
commit ef252a02e5
1797 changed files with 800198 additions and 56 deletions

View File

@@ -0,0 +1,84 @@
name: Deploy NearBeach
on:
release:
types: [published]
workflow_dispatch:
jobs:
deploy-nearbeach:
runs-on: ubuntu-latest
environment: main
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13.1
- name: Update Pip and Install Required Python Libraries
run: |
python3 -m pip install --upgrade pip
python3 -m pip install virtualenv
virtualenv venv
source ./venv/bin/activate
pip install requests setuptools wheel build
pip install --upgrade build
- name: Create __init__.py and PyProject.toml files
run: |
source ./venv/bin/activate
python3 ./.github/deployment_files/generate_templates.py
- name: Build Package
run: |
source ./venv/bin/activate
python3 -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
deploy-static-files:
needs: deploy-nearbeach
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12.1
- name: Create __init__.py and PyProject.toml files
run: |
python3 -m pip install --upgrade pip
python3 -m pip install virtualenv
virtualenv venv
source ./venv/bin/activate
pip install requests drf-spectacular drf-spectacular[sidecar] django-rest-knox
python3 ./.github/deployment_files/generate_templates.py
- name: Install Dependencies
run: |
source ./venv/bin/activate
pip install --editable .[dev]
- name: Collect Static files
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }}
run: |
source ./venv/bin/activate
python manage.py collectstatic --noinput
trigger-docker-build:
needs: [deploy-static-files, deploy-nearbeach]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Curl to trigger docker deployment
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.BEARER_TOKEN_FOR_GITHUB_ACTIONS }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NearBeach/nearbeach-docker/dispatches \
-d '{"event_type":"deploy_nearbeach","client_payload":{"version":"${{ github.ref_name }}"}}'

View File

@@ -0,0 +1,38 @@
name: Build Swagger and Deploy to Azure Static Web App
on:
push:
branches:
- develop # or your deployment branch
workflow_dispatch:
jobs:
build-swagger:
runs-on: ubuntu-latest
steps:
- name: 🧾 Checkout Code
uses: actions/checkout@v3
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11' # Match your dev env
- name: 📦 Install Dependencies
run: |
python -m pip install --upgrade pip
pip install django django-rest-framework simplejson pillow drf-spectacular drf-spectacular[sidecar] python-dotenv django_otp django-two-factor-auth django-two-factor-auth[phonenumberslite] azure-storage-blob azure-identity botocore boto3 django-rest-knox
- name: 🔧 Generate Swagger Schema
run: |
python manage.py spectacular --file swagger/swagger.json
- name: 🚀 Deploy to Azure Static Web Apps
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "upload"
skip_app_build: true
app_location: "swagger"
output_location: "swagger.json"