1import * as path from 'path';
2import { getPackageManifest, getPackageArtifact } from './packages.mjs';
3import { DefaultArtifactClient } from '@actions/artifact';
4
5export const uploadArtifact = async cwd => {
6 const manifest = getPackageManifest(cwd);
7 const artifact = getPackageArtifact(cwd);
8 console.log('> Uploading', manifest.name);
9
10 try {
11 const client = new DefaultArtifactClient();
12 await client.uploadArtifact(artifact, [path.resolve(cwd, artifact)], cwd, {
13 continueOnError: false,
14 });
15 } catch (error) {
16 console.error('> Uploading failed', manifest.name);
17 throw error;
18 }
19};