From cfab6c4b94387aa1a0ff5843319d9e29d66bd14a Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Mon, 27 Jun 2022 12:04:54 +1000 Subject: [PATCH] feat: Use the build information repository to push to Octopus (#56) Release-As: 1.0.0 --- README.md | 3 +- action.yml | 2 - package-lock.json | 264 +++++++++++++++++++++++++++++----- package.json | 2 +- src/input-parameters.ts | 10 +- src/push-build-information.ts | 24 +--- 6 files changed, 241 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 1f0585d..7e8a1b2 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Incorporate the following actions in your workflow to push build information to env: OCTOPUS_HOST: ${{ secrets.OCTOPUS_URL }} OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }} + OCTOPUS_SPACE: '' steps: - uses: actions/checkout@v2 - name: Push build information to Octopus Deploy 🐙 @@ -28,7 +29,6 @@ steps: with: packages: | '' - space: '' version: '' ``` @@ -39,7 +39,6 @@ The following inputs are required: | Name | Description | Default | | :--------- | :------------------------------------------------------------------------- | :-----: | | `packages` | A multi-line list of packages to push build information to Octopus Deploy. | | -| `space` | The name or ID of a space within which this command will be executed. | | | `version` | The version of the package(s). | | The following inputs are optional: diff --git a/action.yml b/action.yml index 91d5c2b..eb8b63e 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,6 @@ inputs: description: 'Determines the action to perform with build information if it already exists in the repository. Valid values are "FailIfExists", "OverwriteExisting", and "IgnoreIfExists".' packages: description: 'A multi-line list of packages to push to Octopus Deploy.' - space: - description: 'The name or ID of a space within which this command will be executed. If omitted, the default space will be used.' version: description: 'The version of the package(s)' diff --git a/package-lock.json b/package-lock.json index 4184b90..5112948 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "^1.9.0", "@actions/github": "^5.0.3", "@octokit/webhooks-types": "^5.8.0", - "@octopusdeploy/api-client": "^1.1.7", + "@octopusdeploy/api-client": "^1.2.1", "@octopusdeploy/message-contracts": "^1.3.0" }, "devDependencies": { @@ -1275,15 +1275,55 @@ "integrity": "sha512-8adktjIb76A7viIdayQSFuBEwOzwhDC+9yxZpKNHjfzrlostHCw0/N7JWpWMObfElwvJMk2fY2l1noENCk9wmw==" }, "node_modules/@octopusdeploy/api-client": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-1.1.7.tgz", - "integrity": "sha512-Uj5T8AbjElT4mMvJ1lgofUNZ/T3LU858ehVHY8VbjWmoHgv9zGe5oO183mFlKN6d2ITqV8xLecawrbUzIRqhMQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-1.2.1.tgz", + "integrity": "sha512-NkkgVMi+IsvklRvoMHT2hpohNhXHJpAlrcVUiyc1rg4pvbMLpIr/4ze8RER7u9o1v46GUpPqgztj7ueKcEtztQ==", "dependencies": { - "@octopusdeploy/message-contracts": "^1.1.1", - "axios": "^0.24.0", + "@octopusdeploy/message-contracts": "^1.3.0", + "axios": "^0.27.2", + "glob": "^8.0.3", + "hpagent": "^1.0.0", "lodash": "^4.17.21", - "semver": "^7.3.5", - "urijs": "^1.19.7" + "moment": "^2.29.3", + "semver": "^7.3.7", + "urijs": "^1.19.11" + } + }, + "node_modules/@octopusdeploy/api-client/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@octopusdeploy/api-client/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@octopusdeploy/api-client/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, "node_modules/@octopusdeploy/message-contracts": { @@ -1892,12 +1932,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", "dependencies": { - "follow-redirects": "^1.14.4" + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" } }, "node_modules/babel-jest": { @@ -1994,8 +2040,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/before-after-hook": { "version": "2.2.2", @@ -2209,6 +2254,17 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2292,6 +2348,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", @@ -3079,11 +3143,23 @@ } } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { "version": "2.3.2", @@ -3349,6 +3425,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hpagent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.0.0.tgz", + "integrity": "sha512-SCleE2Uc1bM752ymxg8QXYGW0TWtAV4ZW3TqH1aOnyi6T6YW2xadCcclm5qeVjvMvfQ2RKNtZxO7uVb9CTPt1A==", + "engines": { + "node": ">=14" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -3421,7 +3505,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -3430,8 +3513,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/internal-slot": { "version": "1.0.3", @@ -4565,6 +4647,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -4604,6 +4705,14 @@ "node": ">=10" } }, + "node_modules/moment": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz", + "integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==", + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -6921,15 +7030,48 @@ "integrity": "sha512-8adktjIb76A7viIdayQSFuBEwOzwhDC+9yxZpKNHjfzrlostHCw0/N7JWpWMObfElwvJMk2fY2l1noENCk9wmw==" }, "@octopusdeploy/api-client": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-1.1.7.tgz", - "integrity": "sha512-Uj5T8AbjElT4mMvJ1lgofUNZ/T3LU858ehVHY8VbjWmoHgv9zGe5oO183mFlKN6d2ITqV8xLecawrbUzIRqhMQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-1.2.1.tgz", + "integrity": "sha512-NkkgVMi+IsvklRvoMHT2hpohNhXHJpAlrcVUiyc1rg4pvbMLpIr/4ze8RER7u9o1v46GUpPqgztj7ueKcEtztQ==", "requires": { - "@octopusdeploy/message-contracts": "^1.1.1", - "axios": "^0.24.0", + "@octopusdeploy/message-contracts": "^1.3.0", + "axios": "^0.27.2", + "glob": "^8.0.3", + "hpagent": "^1.0.0", "lodash": "^4.17.21", - "semver": "^7.3.5", - "urijs": "^1.19.7" + "moment": "^2.29.3", + "semver": "^7.3.7", + "urijs": "^1.19.11" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "@octopusdeploy/message-contracts": { @@ -7362,12 +7504,18 @@ "es-shim-unscopables": "^1.0.0" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", "requires": { - "follow-redirects": "^1.14.4" + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" } }, "babel-jest": { @@ -7443,8 +7591,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "before-after-hook": { "version": "2.2.2", @@ -7601,6 +7748,14 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -7664,6 +7819,11 @@ "object-keys": "^1.1.1" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", @@ -8255,11 +8415,20 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "fsevents": { "version": "2.3.2", @@ -8440,6 +8609,11 @@ "has-symbols": "^1.0.2" } }, + "hpagent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.0.0.tgz", + "integrity": "sha512-SCleE2Uc1bM752ymxg8QXYGW0TWtAV4ZW3TqH1aOnyi6T6YW2xadCcclm5qeVjvMvfQ2RKNtZxO7uVb9CTPt1A==" + }, "html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -8488,7 +8662,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -8497,8 +8670,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "internal-slot": { "version": "1.0.3", @@ -9354,6 +9526,19 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -9381,6 +9566,11 @@ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true }, + "moment": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz", + "integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index 2a0b7a1..5ebe03c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@actions/core": "^1.9.0", "@actions/github": "^5.0.3", "@octokit/webhooks-types": "^5.8.0", - "@octopusdeploy/api-client": "^1.1.7", + "@octopusdeploy/api-client": "^1.2.1", "@octopusdeploy/message-contracts": "^1.3.0" }, "description": "GitHub Action to Push Build Information to Octopus Deploy", diff --git a/src/input-parameters.ts b/src/input-parameters.ts index f4b795e..e591d86 100644 --- a/src/input-parameters.ts +++ b/src/input-parameters.ts @@ -1,21 +1,23 @@ import {getBooleanInput, getMultilineInput, getInput} from '@actions/core' +import {OverwriteMode} from '@octopusdeploy/api-client' export interface InputParameters { branch?: string debug?: boolean - overwriteMode: string + overwriteMode: OverwriteMode packages: string[] - space: string version: string } export function get(): InputParameters { + const overwriteMode: OverwriteMode = + (OverwriteMode as any)[getInput('overwrite_mode')] || // eslint-disable-line @typescript-eslint/no-explicit-any + OverwriteMode.FailIfExists return { branch: getInput('branch'), debug: getBooleanInput('debug'), - overwriteMode: getInput('overwrite_mode'), + overwriteMode, packages: getMultilineInput('packages', {required: true}), - space: getInput('space', {required: true}), version: getInput('version', {required: true}) } } diff --git a/src/push-build-information.ts b/src/push-build-information.ts index 8fb7131..282f473 100644 --- a/src/push-build-information.ts +++ b/src/push-build-information.ts @@ -2,26 +2,12 @@ import {InputParameters} from './input-parameters' import {info, setFailed} from '@actions/core' import {context} from '@actions/github' import {PushEvent, Commit} from '@octokit/webhooks-types/schema' -import {Client, ClientConfiguration} from '@octopusdeploy/api-client' +import {BuildInformationRepository, Client} from '@octopusdeploy/api-client' import { NewOctopusPackageVersionBuildInformationResource, CommitDetail } from '@octopusdeploy/message-contracts' -async function getOctopusClient(parameters: InputParameters): Promise { - const config: ClientConfiguration = { - apiKey: process.env['OCTOPUS_API_KEY'], - apiUri: process.env['OCTOPUS_HOST'], - space: parameters.space, - autoConnect: true - } - - const client: Client = await Client.create(config) - if (client === undefined) throw new Error('Client could not be constructed') - - return client -} - export async function pushBuildInformation( runId: number, parameters: InputParameters @@ -65,8 +51,10 @@ export async function pushBuildInformation( } try { - const client: Client = await getOctopusClient(parameters) - const buildInfoUriTmpl: string = client.getLink('BuildInformation') + const client: Client = await Client.create() + if (client === undefined) throw new Error('Client could not be constructed') + + const buildInfoRepo = new BuildInformationRepository(client) for (const packageId of parameters.packages) { info( @@ -74,7 +62,7 @@ export async function pushBuildInformation( ) build.PackageId = packageId - await client.post(buildInfoUriTmpl, build, { + await buildInfoRepo.create(build, { overwriteMode: parameters.overwriteMode })