Skip to content

Commit 2661050

Browse files
authored
Maintenance on release workflow (#59)
- rename default branch to main - separated release pipeline (security) - improve release drafter config
1 parent 50f27cd commit 2661050

File tree

6 files changed

+110
-79
lines changed

6 files changed

+110
-79
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @ssbarnea

.github/release-drafter.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Format and labels used aim to match those used by Ansible project
2+
name-template: '$RESOLVED_VERSION'
3+
tag-template: '$RESOLVED_VERSION'
24
categories:
35
- title: 'Major Changes'
46
labels:
@@ -7,6 +9,7 @@ categories:
79
labels:
810
- 'feature' # 006b75
911
- 'enhancement' # ededed
12+
- 'refactoring'
1013
- title: 'Bugfixes'
1114
labels:
1215
- 'bug' # fbca04
@@ -15,7 +18,34 @@ categories:
1518
- 'deprecated' # fef2c0
1619
exclude-labels:
1720
- 'skip-changelog'
21+
version-resolver:
22+
major:
23+
labels:
24+
- 'major'
25+
minor:
26+
labels:
27+
- 'minor'
28+
- 'feature'
29+
- 'enhancement'
30+
- 'refactoring'
31+
patch:
32+
labels:
33+
- 'patch'
34+
- 'bug'
35+
- 'deprecated'
36+
default: patch
37+
autolabeler:
38+
- label: 'skip-changelog'
39+
title: '/chore/i'
40+
- label: 'bug'
41+
title: '/fix/i'
42+
- label: 'enhancement'
43+
title: '/(enhance|improve)/i'
44+
- label: 'feature'
45+
title: '/feature/i'
46+
- label: 'dreprecated'
47+
title: '/deprecat/i'
1848
template: |
19-
## Changes
20-
2149
$CHANGES
50+
51+
Kudos goes to: $CONTRIBUTORS

.github/workflows/labels.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://github.com/jesusvasquez333/verify-pr-label-action
2+
name: labels
3+
on:
4+
pull_request_target:
5+
types: [opened, labeled, unlabeled, synchronize]
6+
7+
jobs:
8+
check_pr_labels:
9+
runs-on: ubuntu-latest
10+
name: verify
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Verify PR label action
15+
uses: jesusvasquez333/[email protected]
16+
with:
17+
github-token: '${{ secrets.GITHUB_TOKEN }}'
18+
valid-labels: 'bug, enhancement, feature, refactoring, major, deprecated, skip-changelog'
19+
invalid-labels: 'help wanted, invalid, feedback-needed, incomplete'
20+
pull-request-number: '${{ github.event.pull_request.number }}'
21+
disable-reviews: true
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
name: Release Drafter
1+
name: release-drafter
22

33
on:
44
push:
55
# branches to consider in the event; optional, defaults to all
66
branches:
7-
- master
7+
- main
8+
- 'releases/**'
9+
- 'stable/**'
810

911
jobs:
1012
update_release_draft:
11-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1214
steps:
13-
# Drafts your next Release notes as Pull Requests are merged into "master"
15+
# Drafts your next Release notes as Pull Requests are merged into "main"
1416
- uses: release-drafter/release-drafter@v5
1517
env:
1618
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
pypi:
9+
name: Publish to PyPI registry
10+
environment: release
11+
runs-on: ubuntu-20.04
12+
13+
env:
14+
FORCE_COLOR: 1
15+
PY_COLORS: 1
16+
TOXENV: packaging
17+
TOX_PARALLEL_NO_SPINNER: 1
18+
19+
steps:
20+
- name: Switch to using Python 3.8 by default
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: 3.8
24+
- name: Install tox
25+
run: >-
26+
python3 -m
27+
pip install
28+
--user
29+
tox
30+
- name: Check out src from Git
31+
uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0 # needed by setuptools-scm
34+
- name: Build dists
35+
run: python -m tox
36+
- name: Publish to test.pypi.org
37+
if: >- # "create" workflows run separately from "push" & "pull_request"
38+
github.event_name == 'release'
39+
uses: pypa/gh-action-pypi-publish@master
40+
with:
41+
password: ${{ secrets.testpypi_password }}
42+
repository_url: https://test.pypi.org/legacy/
43+
- name: Publish to pypi.org
44+
if: >- # "create" workflows run separately from "push" & "pull_request"
45+
github.event_name == 'release'
46+
uses: pypa/gh-action-pypi-publish@master
47+
with:
48+
password: ${{ secrets.pypi_password }}

.github/workflows/tox.yml

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ name: tox
33
on:
44
push:
55
branches:
6-
- master
7-
- "[0-9]+.[0-9]+.x"
8-
tags:
9-
- "*"
6+
- main
107

118
pull_request:
129
branches:
13-
- master
14-
- "[0-9]+.[0-9]+.x"
10+
- main
1511

1612
jobs:
1713
build:
@@ -73,70 +69,3 @@ jobs:
7369
pip install tox
7470
- name: Test
7571
run: "tox -e ${{ matrix.tox_env }}"
76-
77-
publish:
78-
name: Publish to PyPI registry
79-
needs:
80-
- build
81-
runs-on: ubuntu-latest
82-
83-
env:
84-
PY_COLORS: 1
85-
TOXENV: packaging
86-
87-
steps:
88-
- name: Switch to using Python 3.6 by default
89-
uses: actions/setup-python@v2
90-
with:
91-
python-version: 3.6
92-
- name: Install tox
93-
run: python -m pip install --user tox
94-
- name: Check out src from Git
95-
uses: actions/checkout@v2
96-
with:
97-
# Get shallow Git history (default) for tag creation events
98-
# but have a complete clone for any other workflows.
99-
# Both options fetch tags but since we're going to remove
100-
# one from HEAD in non-create-tag workflows, we need full
101-
# history for them.
102-
fetch-depth: >-
103-
${{
104-
(
105-
github.event_name == 'create' &&
106-
github.event.ref_type == 'tag'
107-
) &&
108-
1 || 0
109-
}}
110-
- name: Drop Git tags from HEAD for non-tag-create events
111-
if: >-
112-
github.event_name != 'create' ||
113-
github.event.ref_type != 'tag'
114-
run: >-
115-
git tag --points-at HEAD
116-
|
117-
xargs git tag --delete
118-
- name: Build dists
119-
run: python -m tox
120-
- name: Publish to test.pypi.org
121-
if: >-
122-
(
123-
github.event_name == 'push' &&
124-
github.ref == format(
125-
'refs/heads/{0}', github.event.repository.default_branch
126-
)
127-
) ||
128-
(
129-
github.event_name == 'create' &&
130-
github.event.ref_type == 'tag'
131-
)
132-
uses: pypa/gh-action-pypi-publish@master
133-
with:
134-
password: ${{ secrets.testpypi_password }}
135-
repository_url: https://test.pypi.org/legacy/
136-
- name: Publish to pypi.org
137-
if: >- # "create" workflows run separately from "push" & "pull_request"
138-
github.event_name == 'create' &&
139-
github.event.ref_type == 'tag'
140-
uses: pypa/gh-action-pypi-publish@master
141-
with:
142-
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)