Skip to content

Commit

Permalink
ci: workspace link config for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
oscb committed Dec 15, 2023
1 parent e66c61d commit 39385ab
Show file tree
Hide file tree
Showing 22 changed files with 98 additions and 126 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Publish

on:
workflow_dispatch:
inputs:
workspace:
description: 'Workspace to publish. (Leave empty to release everything that needs a release) e.g. core, plugin-idfa'
required: false
type: string
default: ''
secrets:
GITHUB_TOKEN:
required: true
Expand Down Expand Up @@ -45,29 +39,9 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set Working Directory
if: github.event.inputs.workspace != ''
env:
IS_PLUGIN: ${{ startsWith(github.event.inputs.workspace, 'plugin-') }}
run: |
if ${IS_PLUGIN}; then
echo "DIR=packages/plugins/${{github.event.inputs.workspace}}" >> $GITHUB_ENV
else
echo "DIR=packages/${{github.event.inputs.workspace}}" >> $GITHUB_ENV
fi
echo "Setting working directory to: WORKSPACE=$DIR"
- name: Publish (Workspace)
if: github.event.inputs.workspace != ''
working-directory: ${{env.DIR}}
run: yarn release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish (All)
if: github.event.inputs.workspace == ''
run: yarn release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 5 additions & 3 deletions multi-release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
logLevel: "debug",
ignorePackages: ["packages/plugins/**"],
tagFormat: "${name}-v${version}"
tagFormat: "${name}-v${version}",
deps: {
bump: 'satisfy', // Do not trigger a release for every package if the only change is a minor/patch upgrade of dependencies
prefix: '^' // by default all semvers will get set to ^major version
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"sovran": "yarn workspace @segment/sovran-react-native",
"example": "yarn --cwd examples/AnalyticsReactNativeExample",
"e2e": "yarn --cwd examples/E2E",
"build": " yarn workspaces foreach -A --topological-dev run build",
"testAll": " yarn workspaces foreach -A -p run test --passWithNoTests",
"clean": " yarn workspaces foreach -A -p run clean",
"build": "yarn workspaces foreach -A --topological-dev run build",
"testAll": "yarn workspaces foreach -A -p run test --passWithNoTests",
"clean": "yarn workspaces foreach -A -p run clean",
"typescript": "tsc --noEmit --composite false",
"test": "jest",
"lint": "eslint .",
Expand Down
5 changes: 2 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"clean": "rimraf lib node_modules ./src/info.ts",
"test": "jest",
"typescript": "tsc --noEmit",
"postversion": "yarn prebuild",
"prepublish": "yarn prebuild"
"prepack": "yarn prebuild"
},
"dependencies": {
"@segment/tsub": "^2",
Expand All @@ -60,7 +59,7 @@
},
"peerDependencies": {
"@react-native-async-storage/async-storage": "1.x",
"@segment/sovran-react-native": "1.x",
"@segment/sovran-react-native": "workspace:^",
"react": "*",
"react-native": "*",
"react-native-get-random-values": "1.x"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-adjust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-adjust#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"react-native-adjust": "^4.33.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-advertising-id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-advertising-id#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@segment/analytics-react-native": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-amplitudeSession/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-amplitudeSession#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@segment/analytics-react-native": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-appsflyer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-appsflyer#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"react-native-appsflyer": "^6.9.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-branch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-branch#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"react-native-branch": "^5.6.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-braze-middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-braze-middleware#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@segment/analytics-react-native": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-braze/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-braze#readme",
"peerDependencies": {
"@braze/react-native-sdk": "^5.x",
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@braze/react-native-sdk": "^5.x",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-clevertap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"clevertap-react-native": "^1.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-destination-filters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"registry": "https://registry.npmjs.org/"
},
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"@segment/sovran-react-native": "*"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-device-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"peerDependencies": {
"@react-native-firebase/app": "^17.3.2",
"@react-native-firebase/messaging": "^17.3.2",
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@react-native-firebase/app": "^17.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-facebook-app-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-facebook-app-events#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"react-native-fbsdk-next": "^11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"peerDependencies": {
"@react-native-firebase/analytics": "^18.4.0",
"@react-native-firebase/app": "^18.4.0",
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@react-native-firebase/analytics": "^18.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-idfa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-idfa#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*"
"@segment/analytics-react-native": "workspace:^"
},
"devDependencies": {
"@segment/analytics-react-native": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-mixpanel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"homepage": "https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-mixpanel#readme",
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"mixpanel-react-native": "^2.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-onetrust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"registry": "https://registry.npmjs.org/"
},
"peerDependencies": {
"@segment/analytics-react-native": "*",
"@segment/analytics-react-native": "workspace:^",
"@segment/sovran-react-native": "*",
"react-native-onetrust-cmp": "^202308.2.0"
},
Expand Down
10 changes: 4 additions & 6 deletions packages/shared/jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('../../tsconfig');


// Object.entries(compilerOptions.paths).map(([key, value]) => {
// compilerOptions.paths[key] = value.map((p) => path.resolve(__dirname, '../../', p));
// })
Object.entries(compilerOptions.paths).map(([key, value]) => {
compilerOptions.paths[key] = value.map((p) => path.resolve(__dirname, '../../', p));
})

module.exports = {
preset: 'react-native',
Expand Down Expand Up @@ -34,7 +34,5 @@ module.exports = {
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePaths: [compilerOptions.baseUrl],
// Not required to module map as the core packages are referenced as devDependencies inside the workspace,
// but keeping this around in case future packages need manual mapping
// moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
};
5 changes: 2 additions & 3 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module.exports = {
tarballDir: "dist"
}
],
// '@semantic-release/github',
// '@semantic-release/git',
'@semantic-release/github',
'@semantic-release/git',
],
debug: true,
};
Loading

0 comments on commit 39385ab

Please sign in to comment.