Skip to content

Commit

Permalink
- fix issue #7
Browse files Browse the repository at this point in the history
  • Loading branch information
maycuatroi committed Dec 18, 2024
1 parent 58c2729 commit 9a5b247
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 6 deletions.
67 changes: 65 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,82 @@
name: Upload Python Package

on:
push:
branches:
- main
release:
types: [published]

permissions:
contents: read
contents: write

jobs:
deploy:
create-release:
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Update version
id: update_version
run: |
# Read current version
CURRENT_VERSION=$(cat version.txt)
echo "Current version: $CURRENT_VERSION"
# Split version into parts
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR="${VERSION_PARTS[0]}"
MINOR="${VERSION_PARTS[1]}"
PATCH="${VERSION_PARTS[2]}"
# Increment patch version
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "New version: $NEW_VERSION"
# Update version.txt with new version
echo "$NEW_VERSION" > version.txt
# Set output for later steps
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Commit version update
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add version.txt
git commit -m "Bump version to ${{ steps.update_version.outputs.version }}"
git push
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.update_version.outputs.version }}
release_name: Release v${{ steps.update_version.outputs.version }}
draft: false
prerelease: false

deploy:
runs-on: ubuntu-latest
needs: [create-release]
if: github.event_name == 'push' || github.event_name == 'release'

steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include LICENSE
include README.rst
recursive-include django_firebase_auth *
include README.md
include version.txt
5 changes: 2 additions & 3 deletions abstract_auth/abstract_user_profile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from django.contrib.auth import get_user_model
from django.db import models


class AbstractAuthProfile(models.Model):
class Meta:
abstract = True

user = models.OneToOneField(
"auth.User", on_delete=models.CASCADE, related_name="auth_profile"
)
user = models.OneToOneField(get_user_model(), on_delete=models.CASCADE, related_name="profile")
display_name = models.CharField(max_length=255, blank=True, null=True)
phone_number = models.CharField(max_length=255, blank=True, null=True)
photo_url = models.CharField(max_length=255, blank=True, null=True)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
version = (this_directory / "version.txt").read_text().strip()

os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
name="django-firebase-auth",
version="1.2.1",
version=version,
packages=find_packages(),
install_requires=["firebase-admin", "djangorestframework"],
url="https://github.com/maycuatroi/django-firebase-auth",
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.9

0 comments on commit 9a5b247

Please sign in to comment.