Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Restore release pipeline (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Oct 30, 2020
1 parent c2e1515 commit cf12126
Showing 1 changed file with 73 additions and 66 deletions.
139 changes: 73 additions & 66 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ name: tox
on:
create: # is used for publishing to PyPI and TestPyPI
tags: # any tag regardless of its name, no branches
- "**"
push: # only publishes pushes to the main branch to TestPyPI
branches: # any integration branch but not tag
- "master"
tags-ignore:
- "**"
pull_request:
release:
types:
- published # It seems that you can publish directly without creating
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC

Expand Down Expand Up @@ -66,69 +68,74 @@ jobs:
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}"
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}
# publish:
# name: Publish to PyPI registry
# needs:
# - build
# runs-on: ubuntu-latest
publish:
name: Publish to PyPI registry
needs:
- build
runs-on: ubuntu-latest

# env:
# PY_COLORS: 1
# TOXENV: packaging
env:
PY_COLORS: 1
TOXENV: packaging

# steps:
# - name: Switch to using Python 3.6 by default
# uses: actions/setup-python@v2
# with:
# python-version: 3.6
# - name: Install tox
# run: python -m pip install --user tox
# - name: Check out src from Git
# uses: actions/checkout@v2
# with:
# # Get shallow Git history (default) for tag creation events
# # but have a complete clone for any other workflows.
# # Both options fetch tags but since we're going to remove
# # one from HEAD in non-create-tag workflows, we need full
# # history for them.
# fetch-depth: >-
# ${{
# (
# github.event_name == 'create' &&
# github.event.ref_type == 'tag'
# ) &&
# 1 || 0
# }}
# - name: Drop Git tags from HEAD for non-tag-create events
# if: >-
# github.event_name != 'create' ||
# github.event.ref_type != 'tag'
# run: >-
# git tag --points-at HEAD
# |
# xargs git tag --delete
# - name: Build dists
# run: python -m tox
# - name: Publish to test.pypi.org
# if: >-
# (
# github.event_name == 'push' &&
# github.ref == format(
# 'refs/heads/{0}', github.event.repository.default_branch
# )
# ) ||
# (
# github.event_name == 'create' &&
# github.event.ref_type == 'tag'
# )
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.testpypi_password }}
# repository_url: https://test.pypi.org/legacy/
# - name: Publish to pypi.org
# if: >- # "create" workflows run separately from "push" & "pull_request"
# github.event_name == 'create' &&
# github.event.ref_type == 'tag'
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.pypi_password }}
steps:
- name: Switch to using Python 3.6 by default
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: python -m pip install --user tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
# Get shallow Git history (default) for release events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) ||
github.event_name == 'release'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create and non-release events
if: >-
(
github.event_name != 'create' ||
github.event.ref_type != 'tag'
) &&
github.event_name != 'release'
run: >-
git tag --points-at HEAD
|
xargs git tag --delete
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}

0 comments on commit cf12126

Please sign in to comment.