Skip to content

Commit fc1735e

Browse files
authoredMar 12, 2025··
[1.3.1] feat: Add ZEUS_DEPLOY_{FROM,TO}_VERSION to running tasks (#30)
1 parent d913626 commit fc1735e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
 

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

22
**[Current]**
3+
1.3.1:
4+
- Adds `ZEUS_DEPLOY_FROM_VERSION` and `ZEUS_DEPLOY_TO_VERSION`, automatically injected to scripts, upgrades, and all tasks run via `zeus run`.
5+
36
1.3.0:
47
**Bugs**
58
- Fixes a bug where deploying Beacon contracts did not work.

‎src/commands/run.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { assertInRepo, inRepo, requires, TState } from './inject';
44
import { loadExistingEnvs } from './env/cmd/list';
55
import { execSync } from 'child_process';
66
import { canonicalPaths } from '../metadata/paths';
7-
import { TDeployedContract, TDeployedContractsManifest, TDeployStateMutations, TEnvironmentManifest } from '../metadata/schema';
7+
import { TDeploy, TDeployedContract, TDeployedContractsManifest, TDeployManifest, TDeployStateMutations, TEnvironmentManifest, TUpgrade } from '../metadata/schema';
88
import { TDeployedInstance } from '../metadata/schema';
99
import * as allArgs from './args';
1010
import { Transaction } from '../metadata/metadataStore';
@@ -52,6 +52,10 @@ export interface TBaseZeusEnv {
5252
ZEUS_ENV_COMMIT: string,
5353
ZEUS_ENV_VERSION: string
5454
ZEUS_VERSION: string
55+
56+
// information from the zeus upgrade object (from => to)
57+
ZEUS_DEPLOY_FROM_VERSION: string,
58+
ZEUS_DEPLOY_TO_VERSION: string,
5559
}
5660

5761
// if `withDeploy` is specified, we also inject instances/statics updated as part of the deploy.
@@ -60,7 +64,10 @@ export const injectableEnvForEnvironment: (txn: Transaction, env: string, withDe
6064
if (!envManifest._.id) {
6165
throw new Error(`No such environment: ${env}`);
6266
}
63-
67+
68+
const deployInfo = withDeploy ? (await txn.getJSONFile<TDeploy>(canonicalPaths.deployStatus({env, name: withDeploy})))._ : undefined;
69+
const upgradeInfo = (withDeploy && deployInfo) ? (await txn.getJSONFile<TUpgrade>(canonicalPaths.upgradeManifest(deployInfo.upgrade))) : undefined;
70+
6471
const deployManifest: TDeployedContractsManifest = withDeploy ? (await txn.getJSONFile<TDeployedContractsManifest>(canonicalPaths.deployDeployedContracts({env, name: withDeploy})))._ : {contracts: []};
6572
const deployParameters = await txn.getJSONFile<Record<string, string>>(canonicalPaths.deployParameters(
6673
'',
@@ -96,6 +103,10 @@ export const injectableEnvForEnvironment: (txn: Transaction, env: string, withDe
96103
ZEUS_ENV_COMMIT: envManifest._.latestDeployedCommit,
97104
ZEUS_TEST: 'false', /* test environments should override this */
98105
ZEUS_ENV_VERSION: envManifest._.deployedVersion,
106+
107+
ZEUS_DEPLOY_FROM_VERSION: upgradeInfo?._.from ?? ``,
108+
ZEUS_DEPLOY_TO_VERSION: upgradeInfo?._.to ?? ``,
109+
99110
ZEUS_VERSION: zeusInfo.Version,
100111
...(deployParametersToEnvironmentVariables({
101112
...(deployParameters._ ?? {}),

0 commit comments

Comments
 (0)
Please sign in to comment.