Skip to content

Commit 68c5a6d

Browse files
jamesnroktCopilot
andauthored
ci: Release process (#288)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 066b464 commit 68c5a6d

6 files changed

Lines changed: 551 additions & 78 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release Draft
2+
3+
on:
4+
workflow_dispatch: # checkov:skip=CKV_GHA_7
5+
inputs:
6+
bump-type:
7+
description: Version bump type
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
create-release-pr:
21+
name: Create Release PR
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Read current version
30+
id: current-version
31+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
32+
33+
- name: Bump version
34+
id: bump-version
35+
uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0
36+
with:
37+
current_version: ${{ steps.current-version.outputs.version }}
38+
level: ${{ github.event.inputs.bump-type || 'patch' }}
39+
40+
- name: Write new version to VERSION
41+
run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION
42+
43+
- name: Update package.json version
44+
run: npm version "${{ steps.bump-version.outputs.new_version }}" --no-git-tag-version
45+
46+
- name: Generate changelog from git history
47+
id: changelog
48+
uses: ROKT/rokt-workflows/actions/generate-changelog@main
49+
with:
50+
version: ${{ steps.bump-version.outputs.new_version }}
51+
52+
- name: Generate GitHub App token
53+
id: generate-token
54+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
55+
with:
56+
app-id: ${{ secrets.SDK_RELEASE_GITHUB_APP_ID }}
57+
private-key: ${{ secrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEY }}
58+
owner: ${{ github.repository_owner }}
59+
repositories: |
60+
react-native-mparticle
61+
62+
- name: Create release PR
63+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
64+
with:
65+
token: ${{ steps.generate-token.outputs.token }}
66+
branch: release/${{ steps.bump-version.outputs.new_version }}
67+
title: 'chore: release ${{ steps.bump-version.outputs.new_version }}'
68+
body: |
69+
## Release ${{ steps.bump-version.outputs.new_version }}
70+
71+
These files should have changed during the release, if they didn't then this is likely an issue and should be investigated:
72+
- package.json
73+
- CHANGELOG.md
74+
75+
${{ steps.changelog.outputs.release-notes }}
76+
commit-message: 'chore: bump version to ${{ steps.bump-version.outputs.new_version }}'
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- VERSION
9+
10+
permissions:
11+
contents: write
12+
id-token: write # Required for npm OIDC trusted publishing
13+
14+
jobs:
15+
react-tests:
16+
name: Run React Native Unit Tests
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 24
26+
cache: yarn
27+
cache-dependency-path: yarn.lock
28+
29+
- name: Install node modules
30+
run: yarn install
31+
32+
- name: Run tests
33+
run: yarn test
34+
35+
android-unit-tests:
36+
name: Run Android Unit Tests
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Run Android Unit Tests
43+
run: cd android && ./gradlew test
44+
45+
publish:
46+
name: Publish to npm and Create GitHub Release
47+
runs-on: ubuntu-latest
48+
needs: [react-tests, android-unit-tests]
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Read version from VERSION
54+
id: version
55+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 24
61+
registry-url: https://registry.npmjs.org
62+
cache: yarn
63+
cache-dependency-path: yarn.lock
64+
65+
- name: Install node modules
66+
run: yarn install
67+
68+
- name: Build SDK
69+
run: yarn build
70+
71+
- name: Ensure npm CLI supports OIDC
72+
run: npm install -g npm@latest
73+
74+
- name: Extract release notes from CHANGELOG.md
75+
id: release-notes
76+
uses: ffurrer2/extract-release-notes@202313ec7461b6b9e401996714484690ab1ae105
77+
with:
78+
release_notes_file: RELEASE_NOTES.md
79+
80+
- name: Publish to npm
81+
run: npm publish --provenance
82+
83+
- name: Create GitHub Release
84+
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b
85+
with:
86+
tag: ${{ steps.version.outputs.version }}
87+
name: ${{ steps.version.outputs.version }}
88+
bodyFile: RELEASE_NOTES.md
89+
commit: ${{ github.sha }}

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)