mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-26 00:18:30 +02:00
V2 Setup
This commit is contained in:
parent
18f0f591fb
commit
6ced765a9f
12 changed files with 4792 additions and 4 deletions
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules/
|
||||||
|
lib/
|
||||||
|
dist/
|
16
.eslintrc.json
Normal file
16
.eslintrc.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"env": { "node": true, "jest": true },
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": { "ecmaVersion": 9, "sourceType": "module" },
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings",
|
||||||
|
"plugin:import/typescript",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"prettier/@typescript-eslint"
|
||||||
|
],
|
||||||
|
"plugins": ["@typescript-eslint"]
|
||||||
|
}
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Ignore node_modules, ncc is used to compile nodejs modules into a single file in the releases branch
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Ignore js files that are transpiled from ts files in src/
|
||||||
|
lib/
|
3
.prettierignore
Normal file
3
.prettierignore
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
dist/
|
||||||
|
lib/
|
||||||
|
node_modules/
|
11
.prettierrc.json
Normal file
11
.prettierrc.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
|
@ -4,9 +4,10 @@ author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
name:
|
name:
|
||||||
description: 'Artifact name'
|
description: 'Artifact name'
|
||||||
required: true
|
required: false
|
||||||
path:
|
path:
|
||||||
description: 'Destination path'
|
description: 'Destination path'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
# Plugins live on the runner and are only available to a certain set of first party actions.
|
using: 'node12'
|
||||||
plugin: 'download'
|
main: 'dist/index.js'
|
2304
dist/index.js
vendored
Normal file
2304
dist/index.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
2362
package-lock.json
generated
Normal file
2362
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
41
package.json
Normal file
41
package.json
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "download-artifact",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Download a build artifact that was previously uploaded in the workflow by the upload-artifact action",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"release": "ncc build src/download-artifact.ts && git add -f dist/",
|
||||||
|
"check-all": "concurrently \"npm:format-check\" \"npm:lint\" \"npm:build\"",
|
||||||
|
"format": "prettier --write **/*.ts",
|
||||||
|
"format-check": "prettier --check **/*.ts",
|
||||||
|
"lint": "eslint **/*.ts"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/download-artifact.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Actions",
|
||||||
|
"GitHub",
|
||||||
|
"Artifacts",
|
||||||
|
"Download"
|
||||||
|
],
|
||||||
|
"author": "GitHub",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/download-artifact/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/actions/download-artifact#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/artifact": "^0.1.0",
|
||||||
|
"@actions/core": "^1.2.2",
|
||||||
|
"@typescript-eslint/parser": "^2.20.0",
|
||||||
|
"@zeit/ncc": "^0.21.1",
|
||||||
|
"concurrently": "^5.1.0",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"eslint-plugin-github": "^3.4.1",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"typescript": "^3.7.5"
|
||||||
|
}
|
||||||
|
}
|
4
src/constants.ts
Normal file
4
src/constants.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export enum Inputs {
|
||||||
|
Name = 'name',
|
||||||
|
Path = 'path'
|
||||||
|
}
|
25
src/download-artifact.ts
Normal file
25
src/download-artifact.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import * as core from '@actions/core'
|
||||||
|
import * as artifact from '@actions/artifact'
|
||||||
|
import {Inputs} from './constants'
|
||||||
|
|
||||||
|
async function run(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const name = core.getInput(Inputs.Name, {required: false})
|
||||||
|
const path = core.getInput(Inputs.Path, {required: false})
|
||||||
|
const artifactClient = artifact.create()
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
// download all artifacts
|
||||||
|
await artifactClient.downloadAllArtifacts(path)
|
||||||
|
} else {
|
||||||
|
// download a single artifact
|
||||||
|
await artifactClient.downloadArtifact(name, path, {
|
||||||
|
createArtifactFolder: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
core.setFailed(err.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
run()
|
13
tsconfig.json
Normal file
13
tsconfig.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue