Skip to content

Commit

Permalink
Use different paths after v0.17.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed Mar 17, 2024
1 parent 7e64c71 commit 92513f7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
version: [ 0.16.0, 0.18.0 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: |
latest=$(curl -s 'https://raw.githubusercontent.com/dfinity/sdk/master/public/manifest.json' | jq -r '.tags.latest')
echo "LATEST=$latest" >> "$GITHUB_ENV"
- uses: ./
with:
dfx-version: ${{ env.LATEST }}
dfx-version: ${{ matrix.version }}
install-moc: true
vessel-version: 0.7.0
- run: |
Expand Down
15 changes: 14 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,21 @@ function run() {
core.info(`Setup dfx version ${dfxVersion}${dfxDisableEncryption ? ' (without encryption)' : ''}`);
// Opt-out of having data collected about dfx usage.
core.exportVariable('DFX_TELEMETRY_DISABLED', 1);
// Set dfx version.
core.exportVariable('DFX_VERSION', dfxVersion);
if ((0, semver_1.gte)(dfxVersion, "0.17.0")) {
const dfxPath = yield io.which('dfx');
core.exportVariable('DFXVM_INIT_YES', 'true');
infoExec(`${dfxPath} --version`);
if (os_1.default.platform() === 'linux') {
core.addPath(`${bin}/dfx/bin`);
}
else {
core.addPath(`/usr/local/Library/Application Support/org.dfinity.dfx/bin`);
}
}
// Install dfx.
child_process_1.default.execSync(`DFX_VERSION=${dfxVersion} DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"`);
child_process_1.default.execSync(`sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"`);
const dfxPath = yield io.which('dfx');
core.debug(dfxPath);
infoExec(`${dfxPath} --version`);
Expand Down
17 changes: 16 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,23 @@ export async function run() {
// Opt-out of having data collected about dfx usage.
core.exportVariable('DFX_TELEMETRY_DISABLED', 1);

// Set dfx version.
core.exportVariable('DFX_VERSION', dfxVersion);

if (gte(dfxVersion, "0.17.0")) {
const dfxPath = await io.which('dfx');
core.exportVariable('DFXVM_INIT_YES', 'true');
infoExec(`${dfxPath} --version`);

if (os.platform() === 'linux') {
core.addPath(`${bin}/dfx/bin`)
} else {
core.addPath(`/usr/local/Library/Application Support/org.dfinity.dfx/bin`);
}
}

// Install dfx.
cp.execSync(`DFX_VERSION=${dfxVersion} DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"`);
cp.execSync(`sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"`);

const dfxPath = await io.which('dfx');
core.debug(dfxPath);
Expand Down

0 comments on commit 92513f7

Please sign in to comment.