Skip to content

Commit

Permalink
chore: adopt devtools reusable workflows (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 10, 2022
1 parent b4c97dc commit 1d547b9
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 124 deletions.
23 changes: 2 additions & 21 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
# Format and labels used aim to match those used by Ansible project
categories:
- title: 'Major Changes'
labels:
- 'major' # c6476b
- title: 'Minor Changes'
labels:
- 'feature' # 006b75
- 'enhancement' # ededed
- title: 'Bugfixes'
labels:
- 'bug' # fbca04
- title: 'Deprecations'
labels:
- 'deprecated' # fef2c0
exclude-labels:
- 'skip-changelog'
template: |
## Changes
$CHANGES
# see https://github.com/ansible-community/devtools
_extends: ansible-community/devtools
9 changes: 9 additions & 0 deletions .github/workflows/ack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
name: ack
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible-community/devtools/.github/workflows/ack.yml@main
12 changes: 12 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/push.yml
name: push
on:
push:
branches:
- main
- 'releases/**'
- 'stable/**'

jobs:
ack:
uses: ansible-community/devtools/.github/workflows/push.yml@main
20 changes: 0 additions & 20 deletions .github/workflows/release-drafter.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release

on:
release:
types: [published]

jobs:
pypi:
name: Publish to PyPI registry
environment: release
runs-on: ubuntu-20.04

env:
FORCE_COLOR: 1
PY_COLORS: 1
TOXENV: packaging
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: Switch to using Python 3.8 by default
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install tox
run: >-
python3 -m
pip install
--user
tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Build dists
run: python -m tox
- name: Publish to test.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.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 }}
91 changes: 8 additions & 83 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,93 +158,18 @@ jobs:
- name: Run tox -e ${{ matrix.tox_env }}
run: |
tox -e ${{ matrix.tox_env }}
publish:
name: Publish to PyPI registry
check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- linters
- unit
runs-on: ubuntu-latest

env:
PY_COLORS: 1
TOXENV: packaging
TOX_PARALLEL_NO_SPINNER: 1
runs-on: ubuntu-latest

steps:
- name: Switch to using Python 3.8 by default
uses: actions/setup-python@v2
with:
python-version: 3.8
- 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: Instruct setuptools-scm not to add a local version part
if: >-
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
run: |
echo 'local_scheme = "no-local-version"' >> pyproject.toml
git update-index --assume-unchanged pyproject.toml
- name: Pre-populate tox env
run: >-
python -m
tox
--parallel auto
--parallel-live
--notest
--skip-missing-interpreters false
-vvvv
- name: Build dists
run: python -m tox -p auto --parallel-live -vvvv
- 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
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
password: ${{ secrets.pypi_password }}
jobs: ${{ toJSON(needs) }}

0 comments on commit 1d547b9

Please sign in to comment.