• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env node
2// Copyright 2021 Google LLC
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15// Script for uploading an artifact. Returns 0 on success.
16// Usage: upload.js <aritfactName> <rootDirectory> <file 1>...<file N>
17
18const fs = require('fs');
19const artifact = require('@actions/artifact');
20const artifactClient = artifact.create()
21const artifactName = process.argv[2];
22const rootDirectory = process.argv[3]
23const files = process.argv.slice(4);
24const options = {
25    continueOnError: true
26}
27
28const uploadResult = artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
29console.log(uploadResult);
30if (uploadResult['failedItems']) {
31  return 1;
32}
33return 0;
34