Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at CI and release process improvements #1689

Merged
merged 12 commits into from
Jun 24, 2024
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 🌈'
reinecke marked this conversation as resolved.
Show resolved Hide resolved
# 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'
reinecke marked this conversation as resolved.
Show resolved Hide resolved
# - '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/[email protected]
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/[email protected]
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
Loading