Skip to content

0.31.43

0.31.43 #50

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.12.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
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 }}"}}'