Skip to content

Commit

Permalink
chore: add log
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 28, 2024
1 parent f0d1cb0 commit fa106ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ jobs:

- name: Release Upload Assets
# uses: jaywcjlove/github-action-upload-assets@main
if: steps.create_tag.outputs.successful == 'true'
# if: steps.create_tag.outputs.successful == 'true'
uses: ./
with:
tag: ${{ steps.create_tag.outputs.version }}
asset-path: test.*


4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44970,10 +44970,10 @@ var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
* @returns
*/function getReleaseURL(_x){return _getReleaseURL.apply(this,arguments);}function _getReleaseURL(){_getReleaseURL=(0,asyncToGenerator/* default */.A)(/*#__PURE__*/(0,regeneratorRuntime/* default */.A)().mark(function _callee2(tag){var _context$repo,owner,repo,tagName,myToken,currentTag,octokit,getReleaseResponse;return (0,regeneratorRuntime/* default */.A)().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context$repo=github.context.repo,owner=_context$repo.owner,repo=_context$repo.repo;// Get the tag name from the triggered action
tagName=github.context.ref;myToken=(0,core.getInput)('token');// This removes the 'refs/tags' portion of the string, i.e. from 'refs/tags/v1.12.23' to 'v1.12.23'
currentTag=tag||tagName.replace("refs/tags/","");octokit=(0,github.getOctokit)(myToken);// Get a release from the tag name
currentTag=tag||tagName.replace("refs/tags/","");octokit=(0,github.getOctokit)(myToken);(0,core.info)("Getting release for tag: ".concat(currentTag));// Get a release from the tag name
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
_context2.next=7;return octokit.rest.repos.getReleaseByTag({owner:owner,repo:repo,tag:currentTag});case 7:getReleaseResponse=_context2.sent;return _context2.abrupt("return",getReleaseResponse.data);case 9:case"end":return _context2.stop();}},_callee2);}));return _getReleaseURL.apply(this,arguments);}function getAssetName(assetPath){try{return JSON.parse(assetPath);}catch(error){if(assetPath){return assetPath;}}return undefined;};(0,asyncToGenerator/* default */.A)(/*#__PURE__*/(0,regeneratorRuntime/* default */.A)().mark(function _callee(){var assetPath,tagName,myToken,files,octokit,release,downloadURLs,i,assetFile,contentLength,contentType,headers,assetName,data,response;return (0,regeneratorRuntime/* default */.A)().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:/**
_context2.next=8;return octokit.rest.repos.getReleaseByTag({owner:owner,repo:repo,tag:currentTag});case 8:getReleaseResponse=_context2.sent;return _context2.abrupt("return",getReleaseResponse.data);case 10:case"end":return _context2.stop();}},_callee2);}));return _getReleaseURL.apply(this,arguments);}function getAssetName(assetPath){try{return JSON.parse(assetPath);}catch(error){if(assetPath){return assetPath;}}return undefined;};(0,asyncToGenerator/* default */.A)(/*#__PURE__*/(0,regeneratorRuntime/* default */.A)().mark(function _callee(){var assetPath,tagName,myToken,files,octokit,release,downloadURLs,i,assetFile,contentLength,contentType,headers,assetName,data,response;return (0,regeneratorRuntime/* default */.A)().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:/**
* Get the path to the file to upload
*/assetPath=getAssetName((0,core.getInput)('asset-path',{required:true}));tagName=(0,core.getInput)('tag')||undefined;myToken=(0,core.getInput)('token');_context.prev=3;if(!(!assetPath||assetPath.length===0)){_context.next=6;break;}throw new Error('asset-path must contain a JSON array of quoted paths');case 6:_context.next=8;return glob(assetPath,{});case 8:files=_context.sent;if(!(files.length===0)){_context.next=11;break;}throw new Error('No files found');case 11:octokit=(0,github.getOctokit)(myToken);_context.next=14;return getReleaseURL(tagName);case 14:release=_context.sent;downloadURLs=[];i=0;case 17:if(!(i<files.length)){_context.next=32;break;}assetFile=files[i];// Determine content-length for header to upload asset
contentLength=function contentLength(filePath){return external_fs_default().statSync(filePath).size;};contentType='application/octet-stream';//const contentType = "binary/octet-stream"
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { context, getOctokit } from '@actions/github';
import { getInput, setOutput, setFailed } from '@actions/core';
import { getInput, setOutput, setFailed, info } from '@actions/core';
import { glob } from 'glob';
import fs from 'fs';
import path from 'path';
Expand All @@ -18,7 +18,7 @@ async function getReleaseURL(tag: string | undefined) {
// This removes the 'refs/tags' portion of the string, i.e. from 'refs/tags/v1.12.23' to 'v1.12.23'
const currentTag = tag || tagName.replace("refs/tags/", "");
const octokit = getOctokit(myToken);

info(`Getting release for tag: ${currentTag}`);
// Get a release from the tag name
// API Documentation: https://developer.github.com/v3/repos/releases/#create-a-release
// Octokit Documentation: https://octokit.github.io/rest.js/#octokit-routes-repos-create-release
Expand Down

0 comments on commit fa106ae

Please sign in to comment.