Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Updated deployment. #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run semver-diff
id: semver-diff
uses: tj-actions/[email protected]

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

- name: Upgrade pip
run: pip install -U pip

- name: Install dependencies
run: make install-deploy

- name: Setup git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: bumpversion
run: |
make increase-version PART="${{ steps.semver-diff.outputs.release_type }}"

- name: Build and publish
run: make release
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

- name: Generate CHANGELOG
uses: tj-actions/[email protected]

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
base: "main"
title: "Upgraded ${{ steps.semver-diff.outputs.old_version }} → ${{ steps.semver-diff.outputs.new_version }}"
branch: "chore/upgrade-${{ steps.semver-diff.outputs.old_version }}-to-${{ steps.semver-diff.outputs.new_version }}"
commit-message: "Upgraded from ${{ steps.semver-diff.outputs.old_version }} → ${{ steps.semver-diff.outputs.new_version }}"
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/${{ steps.semver-diff.outputs.old_version }}...${{ steps.semver-diff.outputs.new_version }})"
token: ${{ secrets.PAT_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Self-Documented Makefile see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

.DEFAULT_GOAL := help
PART := minor

# Put it first so that "make" without argument is like "make help".
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-32s-\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

guard-%: ## Checks that env var is set else exits with non 0 mainly used in CI;
@if [ -z '${${*}}' ]; then echo 'Environment variable $* not set' && exit 1; fi

# --------------------------------------------------------
# ------- Python package (pip) management commands -------
# --------------------------------------------------------

clean: clean-build clean-pyc ## remove all build and Python artifacts

clean-build: ## remove build artifacts
@rm -fr build/
@rm -fr dist/
@rm -fr .eggs/
@find . -name '*.egg-info' -exec rm -fr {} +
@find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
@find . -name '*.pyc' -exec rm -f {} +
@find . -name '*.pyo' -exec rm -f {} +
@find . -name '*~' -exec rm -f {} +
@find . -name '__pycache__' -exec rm -fr {} + || true

lint: ## check style with flake8
@flake8 github_deploy

release: dist ## package and upload a release
@twine upload dist/*

dist: clean install-deploy ## builds source and wheel package
@pip install twine==3.4.1
@python setup.py sdist bdist_wheel

increase-version: guard-PART ## Increase project version
@bump2version $(PART)
@git switch -c main

install-wheel: clean ## Install wheel
@echo "Installing wheel..."
@pip install wheel

install: install-wheel ## install the package to the active Python's site-packages
@pip install .

install-deploy: install-wheel
@pip install -e .'[deploy]'

migrations:
@python manage.py makemigrations

.PHONY: clean clean-build clean-pyc dist increase-version install-wheel install install-deploy increase-version lint release migrations
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
else:
LONG_DESCRIPTION = ""

deploy_requires = [
"bump2version",
"readme_renderer[md]",
]

extras_require = {
"deploy": deploy_requires,
}


setup(
name="github-deploy",
Expand All @@ -31,6 +40,7 @@
license="MIT",
packages=find_packages(),
python_requires='>=3.6',
extras_require=extras_require,
install_requires=[
"asyncclick",
"asyncio",
Expand Down