|
| 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 |
0 commit comments