Repository navigation
122 lines (111 loc) · 3.84 KB
/
Copy pathcreate-release.yml
File metadata and controls
122 lines (111 loc) · 3.84 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
name: Create Release
on:
workflow_dispatch:
inputs:
release_type:
description: Type of release
required: true
default: patch
type: choice
options:
- major
- minor
- patch
jobs:
test:
name: Run tests
uses: ./.github/workflows/test.yml
read-version:
name: Read current version and calculate new version
runs-on: ubuntu-latest
outputs:
current_version: ${{ steps.current_version.outputs.version }}
new_version: ${{ steps.new_version.outputs.version }}
steps:
-
name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
-
name: Set up Ruby
uses: ruby/setup-ruby@v1.267.0
with:
ruby-version: "3.4"
bundler-cache: true
-
name: Read current version
id: current_version
run: |
current_version=$(ruby -e "require './lib/semian/version'; puts Semian::VERSION")
echo "version=$current_version" >> $GITHUB_OUTPUT
echo "Current version: $current_version"
-
name: Calculate new version
id: new_version
run: |
chmod +x .github/scripts/calculate_version.sh
.github/scripts/calculate_version.sh \
"${{ steps.current_version.outputs.version }}" \
"${{ github.event.inputs.release_type }}"
create-pr:
name: Create pull request for version bump
runs-on: ubuntu-latest
needs: [test, read-version]
permissions:
contents: write
pull-requests: write
steps:
-
name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: main
fetch-depth: 0
fetch-tags: true
-
name: Set up Ruby
uses: ruby/setup-ruby@v1.267.0
with:
ruby-version: "3.4"
bundler-cache: true
-
name: Create changes
env:
BUNDLE_FROZEN: false
run: |
new_version="${{ needs.read-version.outputs.new_version }}"
# Create version file changes
sed -i "s/VERSION = \".*\"/VERSION = \"$new_version\"/" lib/semian/version.rb
# Create Gemfile.lock changes
bundle install
# Create CHANGELOG changes
chmod +x .github/scripts/update_changelog.sh
.github/scripts/update_changelog.sh \
"${{ needs.read-version.outputs.new_version }}" \
"${{ needs.read-version.outputs.current_version }}"
-
name: Create pull request
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
branch: release/v${{ needs.read-version.outputs.new_version }}
base: main
title: Release v${{ needs.read-version.outputs.new_version }}
body: |
Automated version bump to ${{ needs.read-version.outputs.new_version }}
This PR includes:
- Updated version in `lib/semian/version.rb`
- Updated `Gemfile.lock`
- Updated `CHANGELOG.md`
**Release type:** ${{ github.event.inputs.release_type }}
**Triggered by:** @${{ github.actor }}
After merging this PR, the **Publish Release** workflow will automatically
build the gem and publish it to GitHub releases.
commit-message: Bump version to ${{ needs.read-version.outputs.new_version }}
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
sign-commits: true
add-paths: |
lib/semian/version.rb
Gemfile.lock
CHANGELOG.md