From 7ffc5175d26475658364f0483a2c203365f289b3 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sat, 21 Oct 2023 19:04:20 -0600 Subject: [PATCH 1/3] Rename deployment workflow for accuracy --- ...ell-module.yml => build-test-and-deploy-powershell-module.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{deploy-powershell-module.yml => build-test-and-deploy-powershell-module.yml} (100%) diff --git a/.github/workflows/deploy-powershell-module.yml b/.github/workflows/build-test-and-deploy-powershell-module.yml similarity index 100% rename from .github/workflows/deploy-powershell-module.yml rename to .github/workflows/build-test-and-deploy-powershell-module.yml From 8625f7de9fce089c9f47cfea023b7ece5a3cd0d5 Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 22 Oct 2023 13:38:58 -0600 Subject: [PATCH 2/3] ci: Call build from deployment workflow --- .../build-and-test-powershell-module.yml | 19 +++--------------- ...uild-test-and-deploy-powershell-module.yml | 20 ++++++++++++++++++- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-and-test-powershell-module.yml b/.github/workflows/build-and-test-powershell-module.yml index 85da862..acf336f 100644 --- a/.github/workflows/build-and-test-powershell-module.yml +++ b/.github/workflows/build-and-test-powershell-module.yml @@ -1,25 +1,19 @@ name: build on: - push: - branches: [ "main" ] - paths: [ "src/**", "build/**", "deploy/**", ".github/workflows/**" ] pull_request: branches: [ "main" ] - # Allows you to run this workflow manually from the Actions tab + # Allows you to run this workflow manually from the Actions tab. workflow_dispatch: + + workflow_call: inputs: versionNumber: description: 'The version number to use for the module. This should be in the format of "Major.Minor.Patch". e.g. "1.0.0". Future builds will increment from this version number. This input is optional. If not provided, the previous version numbers Patch will be incremented.' required: false type: string default: '' - deploy: - description: 'Deploy the build artifacts. Only has effect when not building the main branch.' - required: false - type: boolean - default: false env: powerShellModuleName: 'tiPS' # Must match the name in the deployment workflow. @@ -266,10 +260,3 @@ jobs: with: name: ${{ env.deployFilesArtifactName }} path: ${{ env.deployFilesArtifactDirectoryPath }} - - trigger-deployment: - needs: build-and-test - # Only trigger a deployment if this build is for a push (not a PR) and is for the default branch (main). - if: inputs.deploy || (github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) - uses: ./.github/workflows/deploy-powershell-module.yml - secrets: inherit diff --git a/.github/workflows/build-test-and-deploy-powershell-module.yml b/.github/workflows/build-test-and-deploy-powershell-module.yml index 87e6df0..dea925f 100644 --- a/.github/workflows/build-test-and-deploy-powershell-module.yml +++ b/.github/workflows/build-test-and-deploy-powershell-module.yml @@ -1,7 +1,18 @@ name: deploy on: - workflow_call: + push: + branches: main + paths: [ "src/**", "build/**", "deploy/**", ".github/workflows/**" ] + + # Allows you to run this workflow manually from the Actions tab. + workflow_dispatch: + inputs: + versionNumber: + description: 'The version number to use for the module. This should be in the format of "Major.Minor.Patch". e.g. "1.0.0". Future builds will increment from this version number. This input is optional. If not provided, the previous version numbers Patch will be incremented.' + required: false + type: string + default: '' env: powerShellModuleName: 'tiPS' # Must match the name in the build workflow. @@ -11,7 +22,14 @@ env: artifactsDirectoryPath: './artifacts' jobs: + build-and-test: + uses: ./.github/workflows/build-and-test-powershell-module.yml + with: + versionNumber: ${{ github.event.inputs.versionNumber }} + # secrets: inherit + publish-prerelease-module: + needs: build-and-test runs-on: ubuntu-latest outputs: prereleaseVersionNumber: ${{ steps.output-version-number.outputs.prereleaseVersionNumber }} From 79dbc0b3b6974d89a0671cb69486991fe8f20dca Mon Sep 17 00:00:00 2001 From: deadlydog Date: Sun, 22 Oct 2023 13:49:43 -0600 Subject: [PATCH 3/3] ci: Allow build to access deploy secrets --- .github/workflows/build-test-and-deploy-powershell-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-and-deploy-powershell-module.yml b/.github/workflows/build-test-and-deploy-powershell-module.yml index dea925f..c1bd2ce 100644 --- a/.github/workflows/build-test-and-deploy-powershell-module.yml +++ b/.github/workflows/build-test-and-deploy-powershell-module.yml @@ -26,7 +26,7 @@ jobs: uses: ./.github/workflows/build-and-test-powershell-module.yml with: versionNumber: ${{ github.event.inputs.versionNumber }} - # secrets: inherit + secrets: inherit publish-prerelease-module: needs: build-and-test