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/deploy-powershell-module.yml b/.github/workflows/build-test-and-deploy-powershell-module.yml similarity index 93% rename from .github/workflows/deploy-powershell-module.yml rename to .github/workflows/build-test-and-deploy-powershell-module.yml index 87e6df0..c1bd2ce 100644 --- a/.github/workflows/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 }}