Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have deploy workflow consume build workflow #45

Merged
merged 3 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .github/workflows/build-and-test-powershell-module.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 }}
Expand Down