From d1df73bba749cdf250b7ed3a1251b724bed132f5 Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Fri, 17 Feb 2023 14:35:16 +1000 Subject: [PATCH 1/5] added dev guide --- DEVELOPERS_GUIDE.md | 29 +++++++++++++++++++++++++++++ README.md | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 DEVELOPERS_GUIDE.md diff --git a/DEVELOPERS_GUIDE.md b/DEVELOPERS_GUIDE.md new file mode 100644 index 00000000..824dccd2 --- /dev/null +++ b/DEVELOPERS_GUIDE.md @@ -0,0 +1,29 @@ +# Building for testing + +To test a branch in GitHub Actions, an updated `dist/index.js` file is required. + +``` +npm run build +git add dist/. +git commit -m "updating index.js" +git log -q -n 1 dist/index.js | less -F +``` + +From the log output take note of the commit hash and push to GitHub + +In a test GitHub action you can use the branched build of the action by referencing the branch or commit hash, see [here](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsuses) for details on the `uses` syntax. + +```yml +env: + +steps: + # ... + - name: Await task in Octopus Deploy 🐙 + uses: OctopusDeploy/await-task-action@my-branch + env: + OCTOPUS_API_KEY: ${{ secrets.API_KEY }} + OCTOPUS_URL: ${{ secrets.SERVER }} + OCTOPUS_SPACE: 'Outer Space' + with: + server_task_id: {{ steps.some_previous_deployment_step.outputs.server_tasks[0].server_task_id }} +``` diff --git a/README.md b/README.md index a129bf97..14ebbc50 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,10 @@ steps: | :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `task_state` | The final [TaskState](https://github.com/OctopusDeploy/api-client.ts/blob/main/src/features/serverTasks/taskState.ts) (Canceled, Failed, Success, or TimedOut) returned from Octopus, or undefined if Octopus couldn't be contacted to retrieve the state | +## Developers guide + +[Developers Guide](DEVELOPERS_GUIDE.md) + ## 🤝 Contributions Contributions are welcome! :heart: Please read our [Contributing Guide](.github/CONTRIBUTING.md) for information about how to get involved in this project. From 1f7a8a56604ecbe8614d1a2b57be3c7700106e44 Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Fri, 17 Feb 2023 14:35:27 +1000 Subject: [PATCH 2/5] updated api client reference --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9136e8bd..5ccfd816 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.1.4", + "@octopusdeploy/api-client": "^3.0.4", "tmp": "^0.2.1" }, "description": "GitHub Action to Create a Release in Octopus Deploy", @@ -85,4 +85,4 @@ "test:integration": "jest --ci --reporters=default --reporters=jest-junit --testPathPattern=__tests__/integration" }, "version": "3.0.1" -} +} \ No newline at end of file From 2945a0c2cbea88625555fbdfc1c3f5a086f29766 Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Fri, 17 Feb 2023 15:07:28 +1000 Subject: [PATCH 3/5] webstorm files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fd43bedc..12fac0d8 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,4 @@ lib/**/* octo out reports/ +.idea/ From 52eb291cdd1c3e452a20e425403cff9f4ca7a75f Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Fri, 17 Feb 2023 15:07:39 +1000 Subject: [PATCH 4/5] bumped ref --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed046c10..d6879700 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.1.4", + "@octopusdeploy/api-client": "^3.0.4", "tmp": "^0.2.1" }, "devDependencies": { @@ -1226,9 +1226,9 @@ } }, "node_modules/@octopusdeploy/api-client": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.4.tgz", - "integrity": "sha512-ySaVkFouE4sfDpcjJyTBVnPE4BZ6540hH8glfTydzp1B+jjA5q6kIDbk+fu35h2ZRcOu0hAKfIPcLlntpqSnFg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.0.4.tgz", + "integrity": "sha512-ieXccPQY2hoQ70a6EW2lJijKnEMKqs6dgXBrm4J8KZ4RNPaTBeOxT/fwNKL4mZxBXMFeVvum7ZYwmPqd11X6gg==", "dependencies": { "adm-zip": "^0.5.9", "axios": "^1.2.1", @@ -7420,9 +7420,9 @@ } }, "@octopusdeploy/api-client": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.4.tgz", - "integrity": "sha512-ySaVkFouE4sfDpcjJyTBVnPE4BZ6540hH8glfTydzp1B+jjA5q6kIDbk+fu35h2ZRcOu0hAKfIPcLlntpqSnFg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.0.4.tgz", + "integrity": "sha512-ieXccPQY2hoQ70a6EW2lJijKnEMKqs6dgXBrm4J8KZ4RNPaTBeOxT/fwNKL4mZxBXMFeVvum7ZYwmPqd11X6gg==", "requires": { "adm-zip": "^0.5.9", "axios": "^1.2.1", From f14b60dfa10ec91d6d326f7b84be055ce0291687 Mon Sep 17 00:00:00 2001 From: Ben Pearce Date: Fri, 17 Feb 2023 15:08:03 +1000 Subject: [PATCH 5/5] update due to client update --- src/api-wrapper.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/api-wrapper.ts b/src/api-wrapper.ts index a2998ac3..98ad0342 100644 --- a/src/api-wrapper.ts +++ b/src/api-wrapper.ts @@ -1,5 +1,5 @@ import { InputParameters } from './input-parameters' -import { Client, resolveSpaceId, ServerTaskDetails, ServerTaskWaiter, TaskState } from '@octopusdeploy/api-client' +import { Client, resolveSpaceId, ServerTask, ServerTaskWaiter, TaskState } from '@octopusdeploy/api-client' export interface DeploymentResult { serverTaskId: string @@ -17,11 +17,9 @@ export async function waitForTask(client: Client, parameters: InputParameters): parameters.serverTaskId, parameters.pollingInterval * 1000, parameters.timeout * 1000, - (serverTaskDetails: ServerTaskDetails) => { + (task: ServerTask) => { if (parameters.hideProgress !== true) { - client.info( - `waiting for task ${serverTaskDetails.Task.Id}. Status: ${serverTaskDetails.Task.State}. Progress: ${serverTaskDetails.Progress.ProgressPercentage}%` - ) + client.info(`waiting for task ${task.Id}. Status: ${task.State}.`) } } )