diff --git a/.github/workflows/ci.yml b/.github/workflows/main.yml similarity index 72% rename from .github/workflows/ci.yml rename to .github/workflows/main.yml index 5eb5779..7c38e0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/main.yml @@ -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 @@ -14,8 +14,8 @@ jobs: - name: Git config user uses: snow-actions/git-config-user@v1.0.0 with: - name: # Service Account's Name - email: # Service Account's Email Address + name: tiktokbot + email: tiktokbot@users.noreply.github.com - uses: actions/setup-node@v3 with: node-version: 16 @@ -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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..96a7626 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -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/git-config-user@v1.0.0 + with: + name: tiktokbot + email: tiktokbot@users.noreply.github.com + - 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 }} diff --git a/common/config/rush/.npmrc-publish b/common/config/rush/.npmrc-publish index 7ab44c1..d4e5d14 100644 --- a/common/config/rush/.npmrc-publish +++ b/common/config/rush/.npmrc-publish @@ -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} diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index dc417b0..3753628 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -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 } ], diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index d03b73a..ff989d0 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -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 @@ -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. @@ -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 @@ -63,7 +63,7 @@ // */ // // "includeEmailInChangeFile": true // }, - // + // // { // /** // * (Required) Indicates the kind of version policy being defined ("lockStepVersion" or "individualVersion"). @@ -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. @@ -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 @@ -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" + } ] diff --git a/rush.json b/rush.json index 40ee45a..571ca3c 100644 --- a/rush.json +++ b/rush.json @@ -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. @@ -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 } ] }