Skip to content

Commit

Permalink
Merge pull request #3 from tiktok/release-setup
Browse files Browse the repository at this point in the history
Release setup
  • Loading branch information
chengcyber authored Feb 21, 2024
2 parents 1be4079 + 018a3f9 commit 7f21c53
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 20 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: CI
name: Build and Test
on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
branches: [ "main" ]
branches: ['main']
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -14,8 +14,8 @@ jobs:
- name: Git config user
uses: snow-actions/[email protected]
with:
name: # Service Account's Name
email: # Service Account's Email Address
name: tiktokbot
email: [email protected]
- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -25,3 +25,5 @@ jobs:
run: node common/scripts/install-run-rush.js install
- name: Rush rebuild
run: node common/scripts/install-run-rush.js rebuild --verbose --production
- name: Rush test
run: node common/scripts/install-run-rush.js test --verbose
28 changes: 28 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish NPM Packages
on: workflow_dispatch
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
token: ${{ secrets.BOT_ACCESS_TOKEN }}
- name: Git config user
uses: snow-actions/[email protected]
with:
name: tiktokbot
email: [email protected]
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Rush build
run: node common/scripts/install-run-rush.js build --verbose --production
- name: Rush test
run: node common/scripts/install-run-rush.js test --verbose
- name: Rush publish
run: node common/scripts/install-run-rush.js publish --apply --publish --version-policy sparo --target-branch ${{ github.ref_name }}
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
2 changes: 1 addition & 1 deletion common/config/rush/.npmrc-publish
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# environment variable, which can be referenced from .npmrc using ${} expansion. For example:
#
# //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
#
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
14 changes: 14 additions & 0 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@

// This will invoke common/autoinstallers/rush-prettier/node_modules/.bin/pretty-quick
"shellCommand": "pretty-quick --staged"
},
{
"commandKind": "bulk",
"name": "test",
"summary": "Bulk test script",
"description": "This is an command that runs test script separately for each project",
"safeForSimultaneousRushProcesses": false,
"enableParallelism": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": false,
"incremental": false,
"watchForChanges": false,
"disableBuildCache": false
}
],

Expand Down
27 changes: 17 additions & 10 deletions common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
// * SemVer range is usually restricted to a single version.
// */
// "definitionName": "lockStepVersion",
//
//
// /**
// * (Required) The name that will be used for the "versionPolicyName" field in rush.json.
// * This name is also used command-line parameters such as "--version-policy"
// * and "--to-version-policy".
// */
// "policyName": "MyBigFramework",
//
//
// /**
// * (Required) The current version. All packages belonging to the set should have this version
// * in the current branch. When bumping versions, Rush uses this to determine the next version.
// * (The "version" field in package.json is NOT considered.)
// */
// "version": "1.0.0",
//
//
// /**
// * (Required) The type of bump that will be performed when publishing the next release.
// * When creating a release branch in Git, this field should be updated according to the
Expand All @@ -43,7 +43,7 @@
// * Valid values are: "prerelease", "preminor", "minor", "patch", "major"
// */
// "nextBump": "prerelease",
//
//
// /**
// * (Optional) If specified, all packages in the set share a common CHANGELOG.md file.
// * This file is stored with the specified "main" project, which must be a member of the set.
Expand All @@ -52,7 +52,7 @@
// * package in the set.
// */
// "mainProject": "my-app",
//
//
// /**
// * (Optional) If enabled, the "rush change" command will prompt the user for their email address
// * and include it in the JSON change files. If an organization maintains multiple repos, tracking
Expand All @@ -63,7 +63,7 @@
// */
// // "includeEmailInChangeFile": true
// },
//
//
// {
// /**
// * (Required) Indicates the kind of version policy being defined ("lockStepVersion" or "individualVersion").
Expand All @@ -76,9 +76,9 @@
// * is changed.
// */
// "definitionName": "individualVersion",
//
//
// "policyName": "MyRandomLibraries",
//
//
// /**
// * (Optional) This can be used to enforce that all packages in the set must share a common
// * major version number, e.g. because they are from the same major release branch.
Expand All @@ -87,7 +87,7 @@
// * to the types of changes made to each project, according to the "rush change" command.
// */
// "lockedMajor": 3,
//
//
// /**
// * (Optional) When publishing is managed by Rush, by default the "rush change" command will
// * request changes for any projects that are modified by a pull request. These change entries
Expand All @@ -96,7 +96,14 @@
// * belonging to this version policy.
// */
// "exemptFromRushChange": false,
//
//
// // "includeEmailInChangeFile": true
// }
{
"policyName": "sparo",
"definitionName": "lockStepVersion",
"version": "0.0.0",
"nextBump": "patch",
"mainProject": "sparo"
}
]
10 changes: 6 additions & 4 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@
* your PR branch, and in this situation "rush change" will also automatically invoke "git fetch"
* to retrieve the latest activity for the remote main branch.
*/
// "url": "https://github.com/microsoft/rush-example",
"url": "https://github.com/tiktok/sparo",
/**
* The default branch name. This tells "rush change" which remote branch to compare against.
* The default value is "main"
*/
// "defaultBranch": "main",
"defaultBranch": "main"
/**
* The default remote. This tells "rush change" which remote to compare against if the remote URL is
* not set or if a remote matching the provided remote URL is not found.
Expand Down Expand Up @@ -436,11 +436,13 @@
// }
{
"packageName": "sparo",
"projectFolder": "apps/sparo"
"projectFolder": "apps/sparo",
"shouldPublish": true
},
{
"packageName": "sparo-lib",
"projectFolder": "apps/sparo-lib"
"projectFolder": "apps/sparo-lib",
"shouldPublish": true
}
]
}

0 comments on commit 7f21c53

Please sign in to comment.