-
-
Notifications
You must be signed in to change notification settings - Fork 64
84 lines (80 loc) · 2.82 KB
/
deploy-nearbeach.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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.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 }}"}}'