-
Notifications
You must be signed in to change notification settings - Fork 293
87 lines (78 loc) · 2.89 KB
/
release-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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@v4
- 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