@@ -3,6 +3,9 @@ import * as toolCache from '@actions/tool-cache'
33import { exec } from 'node:child_process'
44import { promisify } from 'node:util'
55import os from 'node:os'
6+ import path from 'node:path'
7+ import { mkdir , symlink } from 'fs/promises'
8+ import { existsSync } from 'fs'
69
710const doExec = promisify ( exec )
811
@@ -74,6 +77,35 @@ async function determineInstalledVersion(): Promise<string> {
7477}
7578
7679async function main ( ) {
80+ /**
81+ * const core = require('@actions/core');
82+ const tc = require('@actions/tool-cache');
83+ const fs = require('fs');
84+ const path = require('path');
85+
86+ async function run() {
87+ try {
88+ // Define the path to the downloaded binary
89+ const binaryPath = 'path/to/pglt_aarch64-linux'; // Replace with actual path
90+
91+ // Define the path for the symbolic link
92+ const symlinkPath = path.join(binDir, 'pglt');
93+
94+ // Create the symbolic link
95+ fs.symlinkSync(binaryPath, symlinkPath);
96+
97+ // Add the directory to PATH
98+ core.addPath(binDir);
99+
100+ console.log('Binary is now available as pglt');
101+ } catch (error) {
102+ core.setFailed(`Action failed with error: ${error}`);
103+ }
104+ }
105+
106+ run();
107+
108+ */
77109 try {
78110 const version = core . getInput ( 'version' , { required : true } )
79111
@@ -93,7 +125,16 @@ async function main() {
93125 *******
94126 ` )
95127
96- core . addPath ( tool )
128+ const binDir = path . join ( process . env . HOME ! , 'bin' )
129+ if ( ! existsSync ( binDir ) ) {
130+ core . info ( `Binary dir not found. Creating one at ${ binDir } ` )
131+ await mkdir ( binDir , { recursive : true } )
132+ }
133+
134+ const symlinkPath = path . join ( binDir , 'pglt' )
135+ symlink ( tool , symlinkPath )
136+
137+ core . addPath ( symlinkPath )
97138
98139 const installedVersion = await determineInstalledVersion ( )
99140 core . setOutput ( 'installed-version' , installedVersion )
0 commit comments