Skip to content

Commit

Permalink
Create release action
Browse files Browse the repository at this point in the history
Create an action that uses the pypa/gh-action-pypi-publish reusable
action to automate releases.

Fixes #267
  • Loading branch information
jsocol committed Dec 4, 2022
1 parent d19c098 commit 0829781
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 13 deletions.
28 changes: 28 additions & 0 deletions .github/actions/test/action.yml
@@ -0,0 +1,28 @@
name: test
description: 'runs a test matrix'
inputs:
python-version:
required: true
django-version:
required: true

runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
shell: sh
run: |
python -m pip install --upgrade pip
if [[ ${{ inputs.django-version }} != 'main' ]]; then pip install --pre -q "Django>=${{ inputs.django-version }},<${{ inputs.django-version }}.99"; fi
if [[ ${{ inputs.django-version }} == 'main' ]]; then pip install https://github.com/django/django/archive/main.tar.gz; fi
pip install flake8 django-redis pymemcache
- name: Test
shell: sh
run: |
./run.sh test
15 changes: 2 additions & 13 deletions .github/workflows/ci.yml
Expand Up @@ -28,21 +28,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: ./.github/actions/test
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [[ ${{ matrix.django }} != 'main' ]]; then pip install --pre -q "Django>=${{ matrix.django }},<${{ matrix.django }}.99"; fi
if [[ ${{ matrix.django }} == 'main' ]]; then pip install https://github.com/django/django/archive/main.tar.gz; fi
pip install flake8 django-redis pymemcache
- name: Test
run: |
./run.sh test
django-version: ${{ matrix.django }}

lint:
runs-on: ubuntu-latest
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,56 @@
name: release

on:
push:
tags:
- v*

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
django: ['3.2', '4.0', '4.1']
exclude:
- python-version: '3.7'
django: '4.0'
- python-version: '3.7'
django: '4.1'

steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/test
with:
python-version: ${{ matrix.python-version }}
django-version: ${{ matrix.django }}

release:
runs-on: ubuntu-latest
needs: [test]
steps:

- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: build
run: ./run.sh build

- name: check
run: ./run.sh check

- name: release
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_DEPLOY_TOKEN }}

0 comments on commit 0829781

Please sign in to comment.