-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated anvil-devchain workflow (#11108)
* updated anvil-devchain workflow * PR feedback * ++ other dependent files for this workflow to run * fix build
- Loading branch information
Showing
8 changed files
with
196 additions
and
78 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
35 changes: 35 additions & 0 deletions
35
packages/protocol/scripts/change-anvil-devchain-package-version.ts
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,35 @@ | ||
import { replacePackageVersionAndMakePublic } from '@celo/protocol/scripts/utils' | ||
import * as child_process from 'child_process' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import { DEVCHAIN_ANVIL_PACKAGE_SRC_DIR, TSCONFIG_PATH } from './consts' | ||
|
||
function log(...args: any[]) { | ||
// eslint-disable-next-line | ||
console.info('[prepare-devchain-anvil]', ...args) | ||
} | ||
|
||
try { | ||
log('Setting package.json target to ES2020') | ||
const tsconfig = JSON.parse(fs.readFileSync(TSCONFIG_PATH, 'utf8')) | ||
tsconfig.compilerOptions.target = 'ES2020' | ||
fs.writeFileSync(TSCONFIG_PATH, JSON.stringify(tsconfig, null, 4)) | ||
|
||
prepareAnvilDevchainPackage() | ||
} finally { | ||
log('Cleaning up') | ||
child_process.execSync(`git checkout ${TSCONFIG_PATH}`, { stdio: 'inherit' }) | ||
} | ||
|
||
function prepareAnvilDevchainPackage() { | ||
if (process.env.RELEASE_VERSION) { | ||
log('Replacing @celo/devchain-anvil version with RELEASE_VERSION)') | ||
|
||
const packageJsonPath = path.join(DEVCHAIN_ANVIL_PACKAGE_SRC_DIR, 'package.json') | ||
replacePackageVersionAndMakePublic(packageJsonPath) | ||
|
||
return | ||
} | ||
|
||
log('Skipping @celo/devchain-anvil package.json preparation (no RELEASE_VERSION provided)') | ||
} |
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,6 +1,7 @@ | ||
import { execSync } from 'child_process' | ||
import { determineNextVersion, getReleaseTypeFromSemVer } from './utils' | ||
|
||
const npmPackage = process.env.NPM_PACKAGE?.trim() || '' | ||
const npmTag = process.env.NPM_TAG?.trim() || '' | ||
const gitTag = process.env.GITHUB_TAG || '' | ||
const branchName = execSync('git branch --show-current').toString().trim() | ||
|
@@ -12,7 +13,7 @@ const branchName = execSync('git branch --show-current').toString().trim() | |
// if not on a release branch a dry-run will be done unless an NPM_TAG is provided | ||
// in which case we will try to fetch the last published version with that tag and bump or use the canary to get major and start versioning from there the new tag at 0 | ||
// (e.g. `@celo/[email protected]@custom-tag.0`) | ||
const nextVersion = determineNextVersion(gitTag, branchName, npmTag) | ||
const nextVersion = determineNextVersion(gitTag, branchName, npmPackage, npmTag) | ||
|
||
if (nextVersion === null) { | ||
// dry-run will build the package but not publish it | ||
|
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
Oops, something went wrong.