Skip to content

Commit 28a5709

Browse files
ci: fix release workflow (#28)
* ci: fix-release-workflow * Update .github/workflows/draft-release-publish.yml Co-authored-by: James Newman <james.newman@rokt.com> * Create VERSION * Create and use VERSION file * remove github event check * update checkout action to v6 * address @jamesnrokt comments * address @thomson-t comments * Correct error with using non-existing changelog in workflow * sync method of getting version across workflows --------- Co-authored-by: James Newman <james.newman@rokt.com>
1 parent 1b2e735 commit 28a5709

File tree

7 files changed

+184
-200
lines changed

7 files changed

+184
-200
lines changed

.github/workflows/build-and-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: macOS-15
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v4
10+
uses: actions/checkout@v6
1111

1212
- name: Select Xcode
1313
run: sudo xcode-select -s /Applications/Xcode_16.4.app
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: macOS-15
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v6
3232

3333
- name: Select Xcode
3434
run: sudo xcode-select -s /Applications/Xcode_16.4.app
@@ -55,7 +55,7 @@ jobs:
5555
runs-on: macOS-15
5656
steps:
5757
- name: Checkout
58-
uses: actions/checkout@v4
58+
uses: actions/checkout@v6
5959

6060
- name: Select Xcode
6161
run: sudo xcode-select -s /Applications/Xcode_16.4.app
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Create draft release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump-type:
7+
description: Specify if the version should be bumped as major, minor, patch
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
jobs:
24+
publish-draft-release:
25+
runs-on: macos-latest
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v6
30+
with:
31+
ref: main
32+
33+
- name: Get current version
34+
id: version-file
35+
run: |
36+
version_from_file=$(head -n 1 VERSION)
37+
echo "release-version=$version_from_file" >> $GITHUB_OUTPUT
38+
39+
- name: Bump version
40+
id: bump-version
41+
uses: actions-ecosystem/action-bump-semver@v1
42+
with:
43+
current_version: ${{ steps.version-file.outputs.release-version }}
44+
level: ${{ github.event.inputs.bump-type }}
45+
46+
- name: Update podspec version
47+
run: sed -i '' "s/s\.version[[:space:]]*=[[:space:]]*\"[0-9.]*\"/s.version = \"${{ steps.bump-version.outputs.new_version }}\"/" mParticle-Apple-Media-SDK.podspec
48+
49+
- name: Update VERSION file
50+
run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION
51+
52+
- name: Create Pull Request
53+
uses: peter-evans/create-pull-request@v7
54+
with:
55+
commit-message: "Bump version to ${{ steps.bump-version.outputs.new_version }}"
56+
branch: release/${{ steps.bump-version.outputs.new_version }}
57+
title: "Release ${{ steps.bump-version.outputs.new_version }}"
58+
base: main
59+
body: |
60+
Preparing for release ${{ steps.bump-version.outputs.new_version }}
61+
62+
This PR updates the version from ${{ steps.version-file.outputs.release-version }} to ${{ steps.bump-version.outputs.new_version }} in:
63+
- `mParticle-Apple-Media-SDK.podspec`
64+
- `VERSION`
65+
66+
Bump type: **${{ github.event.inputs.bump-type }}**
67+
68+
**After merging**, this workflow will automatically:
69+
- Create a git tag `${{ steps.bump-version.outputs.new_version }}`
70+
- Publish to CocoaPods trunk

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: macOS-15
3636
steps:
3737
- name: Checkout
38-
uses: actions/checkout@v5
38+
uses: actions/checkout@v6
3939

4040
- name: Select Xcode
4141
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release SDK
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- VERSION
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
release-from-main:
19+
runs-on: macos-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v6
24+
with:
25+
ref: main
26+
fetch-depth: 0
27+
28+
- name: Get current version
29+
id: version-file
30+
run: |
31+
version_from_file=$(head -n 1 VERSION)
32+
echo "release-version=$version_from_file" >> $GITHUB_OUTPUT
33+
34+
- name: Setup Ruby
35+
uses: ruby/setup-ruby@v1
36+
with:
37+
ruby-version: '3.0'
38+
39+
- name: Install CocoaPods
40+
run: gem install cocoapods
41+
42+
- name: Create Github release
43+
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
44+
with:
45+
makeLatest: true
46+
tag: ${{ steps.version-file.outputs.release-version }}
47+
generateReleaseNotes: true
48+
49+
- name: Push to Trunk
50+
env:
51+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
52+
run: |
53+
pod trunk push --allow-warnings mParticle-Apple-Media-SDK.podspec
54+

.github/workflows/sdk-release.yml

Lines changed: 0 additions & 196 deletions
This file was deleted.

0 commit comments

Comments
 (0)