Drop support for Python <3.8 and Django EOL versions (#9) #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' | |
name: Create release and attach sdist | |
jobs: | |
build: | |
name: Build sdist and create release draft | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- name: Get version from tag | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} | |
- name: Check package version (compare package version with tag) | |
id: check_package_version | |
shell: python | |
run: | | |
from packaging.version import parse | |
from setuptools.config import read_configuration | |
package_version = read_configuration('setup.cfg')['metadata']['version'] | |
if parse(package_version) != parse('${{ steps.get_version.outputs.VERSION }}'): | |
print(f'version mismatch: {package_version} (package) vs ${{ steps.get_version.outputs.VERSION }} (tag)') | |
exit(1) | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./dist/django-questionnaire-core-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
asset_name: django-questionnaire-core-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
asset_content_type: application/tar+gzip |