Skip to content

Commit

Permalink
Merge branch 'release/0.31.0-RC1'
Browse files Browse the repository at this point in the history
  • Loading branch information
robotichead committed Feb 28, 2024
2 parents d0a9298 + 3327dc5 commit 65a7505
Show file tree
Hide file tree
Showing 436 changed files with 7,741 additions and 3,634 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Running Tests
command: |
. venv/bin/activate
CI=true coverage run \
CI=true coverage run --branch \
--omit='venv/*,NearBeach/tests/*,NearBeach/migrations/*,*/__init__.py,manage.py,settings.py,NearBeach/admin.py,NearBeach/apps.py' \
manage.py test
coverage report
Expand Down
32 changes: 32 additions & 0 deletions .github/deployment_files/generate_templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from string import Template

import requests


# Get the latest version from Github
results = requests.get("https://api.github.com/repos/NearBeach/NearBeach/releases?page=1&per_page=1")
results_json = results.json()

# Using the results, find the tag name (aka version)
version = results_json[0]['tag_name']

# Create the __init__.py file
with open('./.github/deployment_files/template__init__.txt', 'r') as input_file:
src = Template(input_file.read())
result = src.substitute({'version': version})
input_file.close()

with open('./NearBeach/__init__.py', 'w') as output_file:
output_file.write(result)
output_file.close()

# Create the pyproject.toml file
with open('./.github/deployment_files/template_pyproject.toml', 'r') as input_file:
src = Template(input_file.read())
result = src.substitute({'version': version})
input_file.close()

with open('./pyproject.toml', 'w') as output_file:
output_file.write(result)
output_file.close()

2 changes: 2 additions & 0 deletions .github/deployment_files/template__init__.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name = "NearBeach"
__version__ = "$version"
57 changes: 57 additions & 0 deletions .github/deployment_files/template_pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "NearBeach"
version = "0.31.0-RC1"
dependencies = [
"Django>=3.1",
"simplejson",
"pillow>=10.0.1",
"urllib3",
"boto3",
"azure-storage-blob",
"azure-identity",
"pip>=19.2",
]
requires-python = ">=3.8"
authors = [
{name = "Luke Christopher Clarke", email = "[email protected]"},
]
maintainers = [
{name = "Luke Christopher Clarke", email = "[email protected]"},
]
description = "NearBeach - an open source project management tool"
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"project",
"task",
"project management",
"request for change",
"open source"
]
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.optional-dependencies]
dev = [
"black",
"bandit",
"python-dotenv",
"django-storages",
]

[project.urls]
Homepage = "https://nearbeach.org"
Documentation = "https://nearbeach.readthedocs.org"
Repository = "https://github.com/NearBeach/NearBeach.git"
"Bug Tracker" = "https://nearbeach.youtrack.cloud"

[project.scripts]
"manage.py" = "myproject:django_manage"
62 changes: 0 additions & 62 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/collect-static-files.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/deploy-nearbeach.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
pip install requests setuptools wheel
- name: Create __init__.py and PyProject.toml files
run: |
python3 ./.github/deployment_files/generate_templates.py
- name: Build Package
run: |
python -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 ./.github/deployment_files/generate_templates.py
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
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: |
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 }}"}}'
2 changes: 1 addition & 1 deletion NearBeach/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = "NearBeach"
__version__ = "0.30.35"
__version__ = "local_development"
2 changes: 2 additions & 0 deletions NearBeach/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ListOfTitle,
Notification,
ObjectAssignment,
ObjectNote,
Organisation,
PermissionSet,
Project,
Expand Down Expand Up @@ -66,6 +67,7 @@
admin.site.register(ListOfTitle)
admin.site.register(Notification)
admin.site.register(ObjectAssignment)
admin.site.register(ObjectNote)
admin.site.register(Organisation)
admin.site.register(PermissionSet)
admin.site.register(Project)
Expand Down
Loading

0 comments on commit 65a7505

Please sign in to comment.