This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monorepo Update build and release scripts
- Loading branch information
1 parent
f533ada
commit 1412892
Showing
9 changed files
with
80 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: . | ||
|
||
env: | ||
DISTRIBUTION_ID: E1JYXHU7GFQMKF | ||
BUCKET_NAME: flow.cldcvr.com | ||
AWS_REGION: us-east-1 | ||
ROLE_NAME: flow.cldcvr.com-role | ||
ACCOUNT_ID: 679519065279 | ||
|
||
jobs: | ||
build: | ||
name: Build and upload to amazon s3 | ||
|
@@ -24,13 +28,16 @@ jobs: | |
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js 16.x | ||
- name: Setup Node.js 18.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
node-version: 18.x | ||
|
||
- name: Install pnpm | ||
run: corepack enable && corepack prepare [email protected] --activate | ||
|
||
- name: Install Dependencies and Build | ||
run: export NODE_OPTIONS="--max_old_space_size=8192" && pnpm i && pnpm run build-packages && pnpm run build-storybook | ||
run: make build | ||
|
||
- name: Configure AWS credentials from Test account | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,8 @@ jobs: | |
- name: Install pnpm | ||
run: corepack enable && corepack prepare [email protected] --activate | ||
|
||
- name: Test build | ||
run: make build | ||
- name: Unit tests | ||
run: make test | ||
|
||
- name: ESlint | ||
run: pnpm run lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,8 @@ jobs: | |
with: | ||
node-version: 18.x | ||
|
||
- name: Install Dependencies | ||
run: pnpm i | ||
- name: Install pnpm | ||
run: corepack enable && corepack prepare pnpm@7.26.3 --activate | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
|
@@ -31,9 +31,11 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%B %d, %Y')" | ||
|
||
- name: extract-changelogs | ||
if: steps.changesets.outputs.published == 'true' | ||
id: change-logs | ||
|
@@ -49,6 +51,7 @@ jobs: | |
"@cldcvr/flow-table":"packages/flow-table/CHANGELOG.md", | ||
"@cldcvr/flow-core-config":"packages/flow-core-config/CHANGELOG.md" | ||
} | ||
- name: Send Slack Notification | ||
if: steps.changesets.outputs.published == 'true' | ||
id: slack | ||
|
@@ -97,59 +100,33 @@ jobs: | |
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
||
publish_to_github: | ||
name: Publishing to github registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js 16.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
# Remove original publishConfig in packages/flow-core/package.json | ||
- uses: sergeysova/jq-action@v2 | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/flow-core/package.json`" > packages/flow-core/package.json | ||
|
||
- uses: sergeysova/jq-action@v2 | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/flow-log/package.json`" > packages/flow-log/package.json | ||
|
||
- uses: sergeysova/jq-action@v2 | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/flow-code-editor/package.json`" > packages/flow-code-editor/package.json | ||
|
||
- uses: sergeysova/jq-action@v2 | ||
- name: Setup Node.js 18.x | ||
uses: actions/[email protected] | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/custom-elements-manifest-to-types/package.json`" > packages/custom-elements-manifest-to-types/package.json | ||
node-version: 18.x | ||
|
||
- uses: sergeysova/jq-action@v2 | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/flow-core-config/package.json`" > packages/flow-core-config/package.json | ||
- name: Install pnpm | ||
run: corepack enable && corepack prepare [email protected] --activate | ||
|
||
- uses: sergeysova/jq-action@v2 | ||
with: | ||
cmd: echo "`jq '.publishConfig.registry="https://npm.pkg.github.com"' packages/flow-table/package.json`" > packages/flow-table/package.json | ||
- name: Replace publish URL | ||
run: node replace-publish-config.js https://npm.pkg.github.com | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16.x" | ||
registry-url: "https://npm.pkg.github.com" | ||
always-auth: true | ||
scope: "@cldcvr" | ||
- name: Creating .npmrc | ||
run: | | ||
cat << EOF > "$HOME/.npmrc" | ||
//npm.pkg.github.com/:_authToken=$NPM_TOKEN | ||
EOF | ||
env: | ||
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release Pull Request or Publish to github | ||
id: changesets | ||
uses: changesets/action@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
. "$(dirname "$0")/_/husky.sh" | ||
|
||
pnpm i | ||
pnpm tsc -b & | ||
pnpm tsc -b & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const { execSync } = require("child_process"); | ||
const process = require("process"); | ||
|
||
const args = process.argv.slice(2); | ||
const fs = require("fs"); | ||
|
||
if (args.length !== 1) { | ||
console.error(`Invalid arguments to command: ${args}`); | ||
console.error(`Only pass the URL to the published registry`); | ||
process.exit(1); | ||
} | ||
|
||
const publishUrl = args[0]; | ||
|
||
const packageFiles = execSync('find ./packages -name "package.json"', { | ||
cwd: __dirname, | ||
encoding: "utf-8" | ||
}) | ||
.split("\n") | ||
.filter(Boolean); | ||
|
||
console.log( | ||
`Going to replace publishConfig.registry with ${publishUrl} in ${packageFiles.length} files \n\n` | ||
); | ||
|
||
packageFiles.forEach(packageFile => { | ||
const packageJson = require(packageFile); | ||
|
||
if (!packageJson.publishConfig) { | ||
console.error(`No publishConfig in ${packageFile}`); | ||
return; | ||
} | ||
|
||
packageJson.publishConfig.registry = publishUrl; | ||
console.log(`Writing ${packageFile}`); | ||
fs.writeFileSync(packageFile, `${JSON.stringify(packageJson, null, 2)}\n`, "utf-8"); | ||
}); |