Skip to content

Commit

Permalink
First pass at CI and release process improvements (#1689)
Browse files Browse the repository at this point in the history
* First pass at CI and release process improvements

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Update release-preview workflow

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Rename PR labeler config file

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Update config path for PR Tools

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Tweak config path for labeler

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Fix PR labeler config

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Tweak labeler config

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Update secrets key for the Slack webhook URL

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Revise labeling rules

Signed-off-by: Jeff <jhodges@adobe.com>
Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Tweak CI step names

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Automatically included dependabot based dependencies under "maintenance" in the auto-generated changelogs

Signed-off-by: Jeff Hodges <jhodges@frame.io>

* Add front-matter for triage label to new issues

Signed-off-by: Jeff Hodges <jhodges@frame.io>

---------

Signed-off-by: Jeff Hodges <jhodges@frame.io>
Signed-off-by: Jeff <jhodges@adobe.com>
  • Loading branch information
jhodges10 authored Jun 24, 2024
1 parent 40017d3 commit 9195176
Show file tree
Hide file tree
Showing 8 changed files with 352 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
labels: triage
---

# Required:
------------
[ ] I believe this isn't a duplicate topic
Expand Down
28 changes: 28 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://github.com/actions/labeler#common-examples

release-candidate:
- 'CHANGELOG.md'

submodules:
- any: ['src/deps/**']

dependencies:
- any: ['pyproject.toml']

ci:
- '.github/**'

documentation:
- any: ['docs/**']

opentime:
- any: ['src/opentime/**']

'time calculations':
- any: ['src/opentime/**']

otioview:
- any: ['src/opentimelineview/**']

python-bindings:
- any: ['src/py-opentimelineio/**']
131 changes: 131 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# https://github.com/release-drafter/release-drafter#configuration-options

# The template for the body of the draft release
template: |
$CHANGES
# The template to use for each merged pull request
change-template: '* $TITLE @$AUTHOR (#$NUMBER)'
# Characters to escape in $TITLE when inserting into change-template so that they are not interpreted as Markdown format characters
change-title-escapes: '\<*_&' # You can add #

# The template for the name of the draft release
name-template: 'v$RESOLVED_VERSION 🌈'
# The template for the tag of the draft release
tag-template: 'v$RESOLVED_VERSION'

# # Template used calculating the next version number for the release
# version-template: '$MAJOR.$MINOR'
# # Adjust the $RESOLVED_VERSION variable using labels.
# version-resolver:
# # every release is a whole version by default
# default: minor
# major:
# labels:
# - 'feature'
# - 'feat'
# - 'perf'
# minor:
# labels:
# - 'bug'
# - 'bugfix'
# - 'fix'
# - 'build'
# - 'refactor'
# - 'revert'
# - 'test'
# patch:
# labels:
# - 'chore'
# - 'ci'
# - 'docs'
# - 'style'

# automatically a label into a pull request
# https://github.com/release-drafter/release-drafter#autolabeler
autolabeler:
- label: 'feat'
title:
- '/^feat.+/'
branch:
- '/feature\/.+/'
- '/feat\/.+/'
- label: 'fix'
title:
- '/^fix.+/'
branch:
- '/bugfix\/.+/'
- '/hotfix\/.+/'
- '/fix\/.+/'
- label: 'build'
title:
- '/^build.+/'
branch:
- '/build\/.+/'
- label: 'chore'
title:
- '/^chore.+/'
branch:
- '/chore\/.+/'
- label: 'ci'
title:
- '/^ci.+/'
branch:
- '/ci\/.+/'
- label: 'documentation'
title:
- '/^docs.+/'
branch:
- '/docs\/.+/'
- label: 'perf'
title:
- '/^perf.+/'
branch:
- '/perf\/.+/'
- label: 'refactor'
title:
- '/^refactor.+/'
branch:
- '/refactor\/.+/'
- label: 'revert'
title:
- '/^revert.+/'
branch:
- '/revert\/.+/'
- label: 'style'
title:
- '/^style.+/'
branch:
- '/style\/.+/'
- label: 'test'
title:
- '/^test.+/'
branch:
- '/test\/.+/'

# Categorize pull requests using labels
# https://github.com/release-drafter/release-drafter#categorize-pull-requests
categories:
- title: '🚀 Features'
labels:
- 'feat'
- 'feature'
- 'perf'
- title: '📖 Documentation'
labels:
- 'documentation'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- 'bugfix'
- 'fix'
- title: '🧰 Maintenance'
labels:
- 'build'
- 'chore'
- 'dependencies'
- 'ci'
- 'refactor'
- 'revert'
- 'style'
- 'test'
15 changes: 15 additions & 0 deletions .github/scripts/release-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -e

#
# entry script to create a release branch in ci
# generates a release branch named with a utc timestamp
#
echo 'CREATING A RELEASE BRANCH'

# create a release branch locally and remotely
# normalize utc date to YYYY-MM-DD-HH-MM
NEW_BRANCH_NAME="release/$(date -u +%Y-%m-%d-%H-%M)"
echo "NEW BRANCH: $NEW_BRANCH_NAME"
git checkout -b $NEW_BRANCH_NAME
git push origin $NEW_BRANCH_NAME
35 changes: 35 additions & 0 deletions .github/workflows/pr-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pull Request Tools

on:
workflow_dispatch:
pull_request:
types: [
opened, # pr is created
reopened, # pr is reopened after being closed
synchronize, # pr is updated with new commits
]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# label PRs based on the files that were changed
pr-labeler:
name: Label Pull Requests
runs-on: ubuntu-latest
timeout-minutes: 8
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3 # https://github.com/actions/checkout/tree/main#usage

# https://github.com/actions/labeler#usage
- uses: actions/labeler@v4
with:
# https://github.com/actions/labeler#inputs
configuration-path: .github/labeler.yml
sync-labels: true # remove labels when matching files are reverted or no longer changed by the PR
dot: true # auto-include paths starting with dot (e.g.; ~/.github)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish
name: Publish Release to PyPI

on:
release:
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release Preview

# Cancel other related workflows in-progress
concurrency:
group: release-preview-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
create-new-branch:
description: 'Create branch'
type: boolean
required: true
default: true
notify:
description: 'Announce release'
type: boolean
required: true
default: true

jobs:
release-branch:
# run if toggled on and not off an existing release branch
if: ${{github.event.inputs.create-new-branch && github.event.inputs.create-new-branch == 'true' && !startsWith(github.ref,'refs/heads/release/')}}
name: Release Branch
runs-on: ubuntu-latest
outputs:
branch-name: ${{ steps.get-branch-name.outputs.branch-name }}
steps:
- uses: actions/checkout@v3

- name: Create Branch
shell: bash
run: |
sh ./github/scripts/release-branch.sh
- name: Get New Branch Name
id: get-branch-name
shell: bash
run: |
echo ::set-output name=branch-name::$(git rev-parse --abbrev-ref HEAD)
release-preview:
needs: [release-branch]
if: ${{ always() }}
name: Release Preview
runs-on: ubuntu-latest
steps:
- name: Draft or Update a Release
# https://github.com/release-drafter/release-drafter
uses: release-drafter/release-drafter@v5
id: draft-release
with:
publish: false
commitish: ${{needs.release-branch.outputs.branch-name || github.ref_name}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Convert Github markdown to Slack markdown syntax
# https://github.com/LoveToKnow/slackify-markdown-action
uses: LoveToKnow/slackify-markdown-action@v1.0.0
if: ${{ github.event.inputs.notify == 'true' }}
id: slack-markdown
with:
text: |
[Release Notes](https://github.com/AcademySoftwareFoundation/OpenTimelineIO/releases/tag/${{ steps.draft-release.outputs.tag_name }})
${{ steps.draft-release.outputs.body }}
- name: 'Slack Notification to ##opentimelineio'
# https://github.com/rtCamp/action-slack-notify
uses: rtCamp/action-slack-notify@v2
if: ${{ github.event.inputs.notify == 'true' }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASES_URL }}
SLACK_ICON: https://avatars.githubusercontent.com/u/40807682?s=512&v=4
SLACK_LINK_NAMES: true
SLACK_USERNAME: 'OTIO Release Preview'
SLACK_CHANNEL: 'opentimelineio'
SLACK_COLOR: '#5b53ff'
SLACK_TITLE: 'Release Preview for ${{ github.repository }}'
SLACK_MESSAGE: |
${{ steps.slack-markdown.outputs.text }}
SLACK_FOOTER: |
Release Preview of ${{ steps.draft-release.outputs.name }}
MSG_MINIMAL: commit
51 changes: 51 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish Release
# This workflow is called when a new release is published in GitHub.


# Cancel other related workflows in-progress
concurrency:
group: release-publish-${{ github.ref }}
cancel-in-progress: true

on:
release:
types: [published]

jobs:
load-repo:
name: Download GitHub repo
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

announce-release:
runs-on: ubuntu-latest
name: Announce successful release
needs: [load-repo]
steps:
- name: Convert markdown to slack markdown
# https://github.com/LoveToKnow/slackify-markdown-action
uses: LoveToKnow/slackify-markdown-action@v1.0.0
id: slack-markdown
with:
text: |
${{ github.ref_name }} New version of OTIO released!.
[Release Notes](https://github.com/AcademySoftwareFoundation/OpenTimelineIO/releases/tag/${{ github.ref_name }})
- name: 'Slack Notification to #opentimelineio'
# https://github.com/rtCamp/action-slack-notify
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASES_URL }}
SLACK_ICON: https://avatars.githubusercontent.com/u/40807682?s=512&v=4
SLACK_LINK_NAMES: true
SLACK_USERNAME: 'OTIO Release Bot'
SLACK_CHANNEL: 'opentimelineio'
SLACK_COLOR: '#5b53ff'
SLACK_TITLE: 'New OTIO version released!'
SLACK_MESSAGE: |
${{ steps.slack-markdown.outputs.text }}
SLACK_FOOTER: |
Release Published: ${{ github.ref_name }}
MSG_MINIMAL: true

0 comments on commit 9195176

Please sign in to comment.