Skip to content

Commit 9195176

Browse files
authored
First pass at CI and release process improvements (#1689)
* First pass at CI and release process improvements Signed-off-by: Jeff Hodges <[email protected]> * Update release-preview workflow Signed-off-by: Jeff Hodges <[email protected]> * Rename PR labeler config file Signed-off-by: Jeff Hodges <[email protected]> * Update config path for PR Tools Signed-off-by: Jeff Hodges <[email protected]> * Tweak config path for labeler Signed-off-by: Jeff Hodges <[email protected]> * Fix PR labeler config Signed-off-by: Jeff Hodges <[email protected]> * Tweak labeler config Signed-off-by: Jeff Hodges <[email protected]> * Update secrets key for the Slack webhook URL Signed-off-by: Jeff Hodges <[email protected]> * Revise labeling rules Signed-off-by: Jeff <[email protected]> Signed-off-by: Jeff Hodges <[email protected]> * Tweak CI step names Signed-off-by: Jeff Hodges <[email protected]> * Automatically included dependabot based dependencies under "maintenance" in the auto-generated changelogs Signed-off-by: Jeff Hodges <[email protected]> * Add front-matter for triage label to new issues Signed-off-by: Jeff Hodges <[email protected]> --------- Signed-off-by: Jeff Hodges <[email protected]> Signed-off-by: Jeff <[email protected]>
1 parent 40017d3 commit 9195176

File tree

8 files changed

+352
-1
lines changed

8 files changed

+352
-1
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
labels: triage
3+
---
4+
15
# Required:
26
------------
37
[ ] I believe this isn't a duplicate topic

.github/labeler.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://github.com/actions/labeler#common-examples
2+
3+
release-candidate:
4+
- 'CHANGELOG.md'
5+
6+
submodules:
7+
- any: ['src/deps/**']
8+
9+
dependencies:
10+
- any: ['pyproject.toml']
11+
12+
ci:
13+
- '.github/**'
14+
15+
documentation:
16+
- any: ['docs/**']
17+
18+
opentime:
19+
- any: ['src/opentime/**']
20+
21+
'time calculations':
22+
- any: ['src/opentime/**']
23+
24+
otioview:
25+
- any: ['src/opentimelineview/**']
26+
27+
python-bindings:
28+
- any: ['src/py-opentimelineio/**']

.github/release-drafter.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# https://github.com/release-drafter/release-drafter#configuration-options
2+
3+
# The template for the body of the draft release
4+
template: |
5+
$CHANGES
6+
7+
# The template to use for each merged pull request
8+
change-template: '* $TITLE @$AUTHOR (#$NUMBER)'
9+
# Characters to escape in $TITLE when inserting into change-template so that they are not interpreted as Markdown format characters
10+
change-title-escapes: '\<*_&' # You can add #
11+
12+
# The template for the name of the draft release
13+
name-template: 'v$RESOLVED_VERSION 🌈'
14+
# The template for the tag of the draft release
15+
tag-template: 'v$RESOLVED_VERSION'
16+
17+
# # Template used calculating the next version number for the release
18+
# version-template: '$MAJOR.$MINOR'
19+
# # Adjust the $RESOLVED_VERSION variable using labels.
20+
# version-resolver:
21+
# # every release is a whole version by default
22+
# default: minor
23+
# major:
24+
# labels:
25+
# - 'feature'
26+
# - 'feat'
27+
# - 'perf'
28+
# minor:
29+
# labels:
30+
# - 'bug'
31+
# - 'bugfix'
32+
# - 'fix'
33+
# - 'build'
34+
# - 'refactor'
35+
# - 'revert'
36+
# - 'test'
37+
# patch:
38+
# labels:
39+
# - 'chore'
40+
# - 'ci'
41+
# - 'docs'
42+
# - 'style'
43+
44+
# automatically a label into a pull request
45+
# https://github.com/release-drafter/release-drafter#autolabeler
46+
autolabeler:
47+
- label: 'feat'
48+
title:
49+
- '/^feat.+/'
50+
branch:
51+
- '/feature\/.+/'
52+
- '/feat\/.+/'
53+
- label: 'fix'
54+
title:
55+
- '/^fix.+/'
56+
branch:
57+
- '/bugfix\/.+/'
58+
- '/hotfix\/.+/'
59+
- '/fix\/.+/'
60+
- label: 'build'
61+
title:
62+
- '/^build.+/'
63+
branch:
64+
- '/build\/.+/'
65+
- label: 'chore'
66+
title:
67+
- '/^chore.+/'
68+
branch:
69+
- '/chore\/.+/'
70+
- label: 'ci'
71+
title:
72+
- '/^ci.+/'
73+
branch:
74+
- '/ci\/.+/'
75+
- label: 'documentation'
76+
title:
77+
- '/^docs.+/'
78+
branch:
79+
- '/docs\/.+/'
80+
- label: 'perf'
81+
title:
82+
- '/^perf.+/'
83+
branch:
84+
- '/perf\/.+/'
85+
- label: 'refactor'
86+
title:
87+
- '/^refactor.+/'
88+
branch:
89+
- '/refactor\/.+/'
90+
- label: 'revert'
91+
title:
92+
- '/^revert.+/'
93+
branch:
94+
- '/revert\/.+/'
95+
- label: 'style'
96+
title:
97+
- '/^style.+/'
98+
branch:
99+
- '/style\/.+/'
100+
- label: 'test'
101+
title:
102+
- '/^test.+/'
103+
branch:
104+
- '/test\/.+/'
105+
106+
# Categorize pull requests using labels
107+
# https://github.com/release-drafter/release-drafter#categorize-pull-requests
108+
categories:
109+
- title: '🚀 Features'
110+
labels:
111+
- 'feat'
112+
- 'feature'
113+
- 'perf'
114+
- title: '📖 Documentation'
115+
labels:
116+
- 'documentation'
117+
- title: '🐛 Bug Fixes'
118+
labels:
119+
- 'bug'
120+
- 'bugfix'
121+
- 'fix'
122+
- title: '🧰 Maintenance'
123+
labels:
124+
- 'build'
125+
- 'chore'
126+
- 'dependencies'
127+
- 'ci'
128+
- 'refactor'
129+
- 'revert'
130+
- 'style'
131+
- 'test'

.github/scripts/release-branch.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
4+
#
5+
# entry script to create a release branch in ci
6+
# generates a release branch named with a utc timestamp
7+
#
8+
echo 'CREATING A RELEASE BRANCH'
9+
10+
# create a release branch locally and remotely
11+
# normalize utc date to YYYY-MM-DD-HH-MM
12+
NEW_BRANCH_NAME="release/$(date -u +%Y-%m-%d-%H-%M)"
13+
echo "NEW BRANCH: $NEW_BRANCH_NAME"
14+
git checkout -b $NEW_BRANCH_NAME
15+
git push origin $NEW_BRANCH_NAME

.github/workflows/pr-tools.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Pull Request Tools
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [
7+
opened, # pr is created
8+
reopened, # pr is reopened after being closed
9+
synchronize, # pr is updated with new commits
10+
]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
# label PRs based on the files that were changed
18+
pr-labeler:
19+
name: Label Pull Requests
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 8
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
steps:
26+
- name: Checkout Repo
27+
uses: actions/checkout@v3 # https://github.com/actions/checkout/tree/main#usage
28+
29+
# https://github.com/actions/labeler#usage
30+
- uses: actions/labeler@v4
31+
with:
32+
# https://github.com/actions/labeler#inputs
33+
configuration-path: .github/labeler.yml
34+
sync-labels: true # remove labels when matching files are reverted or no longer changed by the PR
35+
dot: true # auto-include paths starting with dot (e.g.; ~/.github)

.github/workflows/publish.yml renamed to .github/workflows/pypi-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: publish
1+
name: Publish Release to PyPI
22

33
on:
44
release:
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release Preview
2+
3+
# Cancel other related workflows in-progress
4+
concurrency:
5+
group: release-preview-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
create-new-branch:
12+
description: 'Create branch'
13+
type: boolean
14+
required: true
15+
default: true
16+
notify:
17+
description: 'Announce release'
18+
type: boolean
19+
required: true
20+
default: true
21+
22+
jobs:
23+
release-branch:
24+
# run if toggled on and not off an existing release branch
25+
if: ${{github.event.inputs.create-new-branch && github.event.inputs.create-new-branch == 'true' && !startsWith(github.ref,'refs/heads/release/')}}
26+
name: Release Branch
27+
runs-on: ubuntu-latest
28+
outputs:
29+
branch-name: ${{ steps.get-branch-name.outputs.branch-name }}
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Create Branch
34+
shell: bash
35+
run: |
36+
sh ./github/scripts/release-branch.sh
37+
38+
- name: Get New Branch Name
39+
id: get-branch-name
40+
shell: bash
41+
run: |
42+
echo ::set-output name=branch-name::$(git rev-parse --abbrev-ref HEAD)
43+
44+
release-preview:
45+
needs: [release-branch]
46+
if: ${{ always() }}
47+
name: Release Preview
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Draft or Update a Release
51+
# https://github.com/release-drafter/release-drafter
52+
uses: release-drafter/release-drafter@v5
53+
id: draft-release
54+
with:
55+
publish: false
56+
commitish: ${{needs.release-branch.outputs.branch-name || github.ref_name}}
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Convert Github markdown to Slack markdown syntax
61+
# https://github.com/LoveToKnow/slackify-markdown-action
62+
uses: LoveToKnow/[email protected]
63+
if: ${{ github.event.inputs.notify == 'true' }}
64+
id: slack-markdown
65+
with:
66+
text: |
67+
[Release Notes](https://github.com/AcademySoftwareFoundation/OpenTimelineIO/releases/tag/${{ steps.draft-release.outputs.tag_name }})
68+
69+
${{ steps.draft-release.outputs.body }}
70+
71+
- name: 'Slack Notification to ##opentimelineio'
72+
# https://github.com/rtCamp/action-slack-notify
73+
uses: rtCamp/action-slack-notify@v2
74+
if: ${{ github.event.inputs.notify == 'true' }}
75+
env:
76+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASES_URL }}
77+
SLACK_ICON: https://avatars.githubusercontent.com/u/40807682?s=512&v=4
78+
SLACK_LINK_NAMES: true
79+
SLACK_USERNAME: 'OTIO Release Preview'
80+
SLACK_CHANNEL: 'opentimelineio'
81+
SLACK_COLOR: '#5b53ff'
82+
SLACK_TITLE: 'Release Preview for ${{ github.repository }}'
83+
SLACK_MESSAGE: |
84+
${{ steps.slack-markdown.outputs.text }}
85+
SLACK_FOOTER: |
86+
Release Preview of ${{ steps.draft-release.outputs.name }}
87+
MSG_MINIMAL: commit
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Release
2+
# This workflow is called when a new release is published in GitHub.
3+
4+
5+
# Cancel other related workflows in-progress
6+
concurrency:
7+
group: release-publish-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
on:
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
load-repo:
16+
name: Download GitHub repo
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 5
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
announce-release:
23+
runs-on: ubuntu-latest
24+
name: Announce successful release
25+
needs: [load-repo]
26+
steps:
27+
- name: Convert markdown to slack markdown
28+
# https://github.com/LoveToKnow/slackify-markdown-action
29+
uses: LoveToKnow/[email protected]
30+
id: slack-markdown
31+
with:
32+
text: |
33+
${{ github.ref_name }} New version of OTIO released!.
34+
[Release Notes](https://github.com/AcademySoftwareFoundation/OpenTimelineIO/releases/tag/${{ github.ref_name }})
35+
36+
- name: 'Slack Notification to #opentimelineio'
37+
# https://github.com/rtCamp/action-slack-notify
38+
uses: rtCamp/action-slack-notify@v2
39+
env:
40+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASES_URL }}
41+
SLACK_ICON: https://avatars.githubusercontent.com/u/40807682?s=512&v=4
42+
SLACK_LINK_NAMES: true
43+
SLACK_USERNAME: 'OTIO Release Bot'
44+
SLACK_CHANNEL: 'opentimelineio'
45+
SLACK_COLOR: '#5b53ff'
46+
SLACK_TITLE: 'New OTIO version released!'
47+
SLACK_MESSAGE: |
48+
${{ steps.slack-markdown.outputs.text }}
49+
SLACK_FOOTER: |
50+
Release Published: ${{ github.ref_name }}
51+
MSG_MINIMAL: true

0 commit comments

Comments
 (0)