Skip to content

Commit

Permalink
Merge pull request #1 from jheerman/feature/add-github-workflows
Browse files Browse the repository at this point in the history
Add build, publish, and release github workflows
  • Loading branch information
jheerman authored May 18, 2023
2 parents a69832f + 85b7f54 commit 93f90fd
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
push:
branches: ['feature/**', 'bugfix/**']
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -q flake8 tox
- name: Lint
run: tox -e flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9, "3.10"]
django: [2.2.*, 3.2.*]
django: [3.2.*, 4.0.*]

steps:
- uses: pinax/testing@v2
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish
on:
push:
branches: ['master']
defaults:
run:
shell: bash
jobs:
tag-trunk:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Tag
id: create-tag
run: |
MAJOR_NUMBER=1
MINOR_NUMBER=0
REVISION_NUMBER=$(git rev-list HEAD --count)
VERSION="${MAJOR_NUMBER}.${MINOR_NUMBER}.${REVISION_NUMBER}"
TAG="v${VERSION}"
git -c user.name="github-actions[bot]" -c user.email="[email protected]" tag $TAG
git push origin $TAG
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release
on:
push:
branches: ['release/**']
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release Notes
id: notes
run: |
current_tag=$(git tag --points-at ${{ GITHUB.SHA }} | head -1)
last_tag=$(git tag -l "*release" --sort=-v:refname | head -1)
# look for last release tag
if [ -n "$last_tag" ]; then
last_ref=$(git show-ref -s $last_tag)
logs=$(git log $last_ref..$GITHUB_SHA --pretty='- %h %s' --date=short)
else
# if the last tag is not found, check again but don't limit results to 1 item
last_tag=$(git tag -l "*release" --sort=-v:refname)
if [ -n "$last_tag" ]; then
last_ref=$(git show-ref -s $last_tag)
logs=$(git log $last_ref..$GITHUB_SHA --pretty='- %h %s' --date=short)
else
# if we still can't find a tag, then get all the commit history
logs=$(git log --pretty='- %h %s' --date=short)
fi
fi
new_tag="${current_tag}-release"
echo "$logs" > release_notes.md
echo "NEW_TAG=$new_tag" >> $GITHUB_OUTPUT
echo "RELEASE_NAME=${new_tag:1}" >> $GITHUB_OUTPUT
git -c user.name="github-actions[bot]" -c user.email="[email protected]" tag $new_tag
git push origin $new_tag
- name: Create Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_TAG: ${{ steps.notes.outputs.NEW_TAG }}
RELEASE_NAME: ${{ steps.notes.outputs.RELEASE_NAME }}
with:
tag_name: ${{ env.NEW_TAG }}
release_name: ${{ env.RELEASE_NAME }}
body_path: release_notes.md
draft: false
prerelease: false
1 change: 0 additions & 1 deletion account/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.urls import NoReverseMatch, reverse
from django.utils.encoding import force_str

import pytz
from account.conf import settings

from .models import PasswordHistory
Expand Down

0 comments on commit 93f90fd

Please sign in to comment.