-
Notifications
You must be signed in to change notification settings - Fork 8
105 lines (91 loc) · 3.03 KB
/
Copy pathdraft-release.yml
File metadata and controls
105 lines (91 loc) · 3.03 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Drafts new mailtrap-ruby release: bumps the version, regenerates the changelog from
# merged PRs, and opens a release PR against main.
#
name: Draft ruby Release
on:
workflow_dispatch:
inputs:
bump_type:
description: "Semver bump type"
required: true
type: choice
options:
- patch
- minor
- major
default: patch
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
jobs:
draft-release:
name: Draft mailtrap-ruby Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Read current version
id: read
run: |
version=$(ruby -r "./lib/mailtrap/version.rb" -e "puts Mailtrap::VERSION")
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Compute next version
id: bump
uses: railsware/github-actions/compute-next-semver@master
with:
current: ${{ steps.read.outputs.version }}
bump-type: ${{ inputs.bump_type }}
- name: Abort if tag already exists
uses: railsware/github-actions/abort-if-tag-exists@master
with:
tag: ${{ steps.bump.outputs.tag }}
- name: Generate release notes
id: notes
uses: railsware/github-actions/generate-release-notes@master
with:
tag: ${{ steps.bump.outputs.tag }}
- name: Update version in version file
if: steps.notes.outputs.release_notes != ''
env:
NEXT: ${{ steps.bump.outputs.next }}
run: |
cat > "./lib/mailtrap/version.rb" <<EOF
# frozen_string_literal: true
module Mailtrap
VERSION = '${NEXT}'
end
EOF
- name: Install dependencies
if: steps.notes.outputs.release_notes != ''
run: |
bundle install
- name: Prepend new section to CHANGELOG.md
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/prepend-changelog@master
with:
version: ${{ steps.bump.outputs.next }}
release-notes: ${{ steps.notes.outputs.release_notes }}
- name: Commit, push, open PR
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/open-sdk-release-pr@master
with:
tag: ${{ steps.bump.outputs.tag }}
current: ${{ steps.read.outputs.version }}
next: ${{ steps.bump.outputs.next }}
bump-type: ${{ inputs.bump_type }}
release-notes: ${{ steps.notes.outputs.release_notes }}
- name: Create draft GitHub release
if: steps.notes.outputs.release_notes != ''
uses: railsware/github-actions/create-draft-github-release@master
with:
tag: ${{ steps.bump.outputs.tag }}
release-notes: ${{ steps.notes.outputs.release_notes }}