Skip to content

Commit

Permalink
ci: update workflows config.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 28, 2024
1 parent 63895ec commit 76988bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
- name: Release Upload Assets
# uses: jaywcjlove/github-action-upload-assets@main
# if: steps.create_tag.outputs.successful == 'true'
continue-on-error: true
uses: ./
with:
tag: ${{ steps.create_tag.outputs.version }}
Expand All @@ -107,6 +108,7 @@ jobs:
- run: echo "Hello World" > tag.txt
- name: Release Upload Assets
# uses: jaywcjlove/github-action-upload-assets@main
continue-on-error: true
uses: ./
with:
tag: v0.3.0
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44979,7 +44979,7 @@ data:fileStream});case 8:response=_context2.sent;return _context2.abrupt("return
;// CONCATENATED MODULE: ./src/index.ts
;(0,asyncToGenerator/* default */.A)(/*#__PURE__*/(0,regeneratorRuntime/* default */.A)().mark(function _callee(){var assetPath,tagName,files,release,downloadURLs,i,assetFile,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;_context.prev=2;if(!(!assetPath||assetPath.length===0)){_context.next=5;break;}throw new Error('asset-path must contain a JSON array of quoted paths');case 5:_context.next=7;return glob(assetPath,{});case 7:files=_context.sent;if(!(files.length===0)){_context.next=10;break;}throw new Error('No files found');case 10:_context.next=12;return getReleaseURL(tagName);case 12:release=_context.sent;downloadURLs=[];i=0;case 15:if(!(i<files.length)){_context.next=26;break;}assetFile=files[i];(0,core.info)("Uploading asset(".concat(github.context.repo.owner,"/").concat(github.context.repo.repo,"): ").concat(assetFile));_context.next=20;return uploadFile(github.context.repo.owner,github.context.repo.repo,release.id,assetFile);case 20:response=_context.sent;downloadURLs.push(response.data.browser_download_url);if(response.status<200||response.status>299){new Error("Asset upload failed \"".concat(assetPath,". Response:\" ").concat(response));}case 23:i++;_context.next=15;break;case 26:(0,core.setOutput)('browser_download_urls',JSON.stringify(downloadURLs));_context.next=33;break;case 29:_context.prev=29;_context.t0=_context["catch"](2);if(_context.t0 instanceof Error){(0,core.info)("Error: ".concat(_context.t0.message));}(0,core.setFailed)(_context.t0);case 33:case"end":return _context.stop();}},_callee,null,[[2,29]]);}))();
*/assetPath=getAssetName((0,core.getInput)('asset-path',{required:true}));tagName=(0,core.getInput)('tag')||undefined;_context.prev=2;if(!(!assetPath||assetPath.length===0)){_context.next=5;break;}throw new Error('asset-path must contain a JSON array of quoted paths');case 5:_context.next=7;return glob(assetPath,{});case 7:files=_context.sent;if(!(files.length===0)){_context.next=10;break;}throw new Error('No files found');case 10:_context.next=12;return getReleaseURL(tagName);case 12:release=_context.sent;downloadURLs=[];i=0;case 15:if(!(i<files.length)){_context.next=26;break;}assetFile=files[i];(0,core.info)("Uploading asset(".concat(github.context.repo.owner,"/").concat(github.context.repo.repo,"): ").concat(assetFile));_context.next=20;return uploadFile(github.context.repo.owner,github.context.repo.repo,release.id,assetFile);case 20:response=_context.sent;downloadURLs.push(response.data.browser_download_url);if(response.status<200||response.status>299){new Error("Asset upload failed \"".concat(assetPath,". Response:\" ").concat(response));}case 23:i++;_context.next=15;break;case 26:(0,core.setOutput)('browser_download_urls',JSON.stringify(downloadURLs));_context.next=33;break;case 29:_context.prev=29;_context.t0=_context["catch"](2);if(_context.t0 instanceof Error){(0,core.warning)("Error: ".concat(_context.t0.message));}(0,core.setFailed)(_context.t0);case 33:case"end":return _context.stop();}},_callee,null,[[2,29]]);}))();
})();

module.exports = __webpack_exports__;
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 } from '@actions/github';
import { getInput, setFailed, setOutput, info } from '@actions/core';
import { getInput, setFailed, setOutput, info, warning } from '@actions/core';
import { glob } from 'glob';
import { getAssetName, getReleaseURL, uploadFile } from './utils';

Expand Down Expand Up @@ -32,7 +32,7 @@ import { getAssetName, getReleaseURL, uploadFile } from './utils';
setOutput('browser_download_urls', JSON.stringify(downloadURLs));
} catch (error) {
if (error instanceof Error) {
info(`Error: ${error.message}`);
warning(`Error: ${error.message}`);
}
setFailed(error as Error);
}
Expand Down

0 comments on commit 76988bb

Please sign in to comment.