bfitzpat edited a comment on issue #1009: Provide a plain text file with the 
latest version of Camel K for easier automation of downloading via the tooling
URL: https://github.com/apache/camel-k/issues/1009#issuecomment-541125957
 
 
   That works. :) 
   
   ```
   async function getLatestCamelKVersion(): Promise<Errorable<string>> {
        const latestURL = 
'https://api.github.com/repos/apache/camel-k/releases/latest';
        const downloadResult = await downloader.toTempFile(latestURL);
        if (failed(downloadResult)) {
                return { succeeded: false, error: [`Failed to establish kubectl 
stable version: ${downloadResult.error[0]}`] };
        }
        const rawtext = fs.readFileSync(downloadResult.result, 'utf-8');
        let latestJSON = JSON.parse(rawtext);
        let tagName = latestJSON.tag_name;
        if (tagName) {
                return { succeeded: true, result: tagName };            
        }
        return { succeeded: false, error: [`Failed to retrieve latest Apache 
Camel K version tag from : ${latestURL}`] };
   }
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to