Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 16 additions & 99 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,16 @@ on:
default: 'true'

jobs:
# Kit release is done from main branch.
confirm-public-repo-main-branch:
name: 'Confirm release is run from public/main branch'
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable

build-and-test:
name: Build and Test
runs-on: ubuntu-latest
needs: confirm-public-repo-main-branch
steps:
- name: Checkout
uses: actions/checkout@v6

- name: NPM install
uses: actions/setup-node@v6
with:
node-version: 24.x

- name: Run NPM CI
run: npm ci

- name: Build Files
run: npm run build

- name: Run Core tests
run: npm run test

- name: Archive npm failure logs
uses: actions/upload-artifact@v6
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

create-release-branch:
name: Create release branch
runs-on: ubuntu-latest
needs:
- build-and-test
- confirm-public-repo-main-branch
steps:
- name: Checkout development branch
uses: actions/checkout@v6
with:
repository: mparticle-integrations/mparticle-javascript-integration-rokt
ref: development

- name: Create and push release branch
run: |
git checkout -b release/${{ github.run_number }}
git push origin release/${{ github.run_number }}
release:
name: Perform Release
runs-on: ubuntu-latest
needs:
- build-and-test
- create-release-branch
- confirm-public-repo-main-branch

# OIDC permissions for npm trusted publishing
permissions:
contents: write
issues: write
pull-requests: write
id-token: write # Required for OIDC authentication with npm
contents: write
issues: write
pull-requests: write
id-token: write

env:
GITHUB_TOKEN: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
Expand All @@ -83,11 +28,12 @@ jobs:
GIT_COMMITTER_EMAIL: developers@mparticle.com

steps:
- name: Checkout public main branch
- name: Checkout staging branch
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: main
ref: staging
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
Expand All @@ -97,9 +43,6 @@ jobs:
git_user_signingkey: true
git_commit_gpgsign: true

- name: Merge release branch into main branch
run: |
git pull origin release/${{ github.run_number }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
Expand All @@ -113,47 +56,21 @@ jobs:
run: npm install -g npm@latest

- name: Release --dry-run
if: ${{ github.event.inputs.dryRun == 'true'}}
run: |
npx semantic-release --dry-run
if: ${{ github.event.inputs.dryRun == 'true' }}
run: npx semantic-release --dry-run

# NPM Publish happens here via OIDC trusted publishing
- name: Release
if: ${{ github.event.inputs.dryRun == 'false'}}
run: |
npx semantic-release
if: ${{ github.event.inputs.dryRun == 'false' }}
run: npx semantic-release

- name: Archive npm failure logs
uses: actions/upload-artifact@v6
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

- name: Push automated release commits to release branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:release/${{ github.run_number }}
sync-repository:
name: Sync repositories
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: ${{ github.repository }}
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}
ref: main

- name: Merge release branch into main branch
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git pull origin release/${{ github.run_number }}
- name: Push release commits to main and development branches
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push origin HEAD:development
git push origin HEAD:main
- name: Delete release branch
- name: Push release commits to main
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git push --delete origin release/${{ github.run_number }}
run: git push origin HEAD:main
3 changes: 0 additions & 3 deletions .github/workflows/reusable-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ jobs:
pr-title-check:
name: Check PR for semantic title
uses: mParticle/mparticle-workflows/.github/workflows/pr-title-check.yml@stable
pr-branch-target-gitflow:
name: Check PR for semantic target branch
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-target-gitflow.yml@stable
52 changes: 52 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Staging Pipeline

on:
push:
branches: [main]

jobs:
build-test-and-stage:
name: Build, Test and Update Staging
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

env:
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com

steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.MP_INTEGRATIONS_SEMANTIC_RELEASE_BOT }}

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test

- name: Archive npm failure logs
uses: actions/upload-artifact@v6
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

- name: Update staging branch
run: |
git checkout -B staging
git add dist -f
git commit -m 'chore(build): Generate latest bundle [skip ci]'
git push origin staging --force
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Thanks for contributing! Please read this document to follow our conventions for
## Setting Up

- Fork the repository and then clone down your fork
- Commit your code per the conventions below, and PR into the mParticle SDK `master` branch
- Commit your code per the conventions below, and PR into the mParticle SDK `main` branch
- Your PR title will be checked automatically against the below convention (view the commit history to see examples of a proper commit/PR title). If it fails, you must update your title.
- Our engineers will work with you to get your code change implemented once a PR is up

Expand Down
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
branches: ['main'],
branches: ['staging'],
tagFormat: 'v${version}',
repositoryUrl:
'https://github.com/mparticle-integrations/mparticle-javascript-integration-rokt',
Expand Down