Skip to content

Commit 518cf12

Browse files
authored
Update pipeline.yml
1 parent 004f9b3 commit 518cf12

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/pipeline.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: SQL CLR Build
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
create_release:
7+
description: 'Create Release'
8+
required: true
9+
default: 'true'
510

611
jobs:
712
build:
@@ -17,8 +22,25 @@ jobs:
1722
dacpac_file: SqlServer.ClrCommon.dacpac
1823
bin_path: ${{ github.workspace }}\\SqlServer.ClrCommon\\bin
1924
database_name: CommonDB
25+
create_release: ${{ github.event.inputs.create_release }}
2026

2127
steps:
28+
- name: Validate Job Input
29+
shell: powershell
30+
run: |
31+
[object]$val = $env:create_release
32+
[bool]$bval = $false
33+
[int]$ival = $false
34+
35+
if ([boolean]::TryParse($val, [ref]$bval)) {
36+
$env:create_release = $bval
37+
} elseif ([int32]::TryParse($val, [ref]$ival)) {
38+
$env:create_release = [bool]($ival -eq 0)
39+
} else {
40+
throw "The value ($val) is not valid for [Create Release] and cannot be converted to a boolean. Please try again."
41+
exit 1
42+
}
43+
2244
- name: Checkout
2345
uses: actions/checkout@v2
2446
with:
@@ -95,13 +117,13 @@ jobs:
95117
- name: Bump version and push tag
96118
id: tag_version
97119
uses: mathieudutour/github-tag-action@v5.6
98-
if: ${{ github.ref == 'refs/heads/master' }}
120+
if: ${{ github.ref == 'refs/heads/master' && env.create_release }}
99121
with:
100122
github_token: "${{ secrets.GITHUB_TOKEN }}"
101123

102124
- name: Create Release
103125
uses: ncipollo/release-action@v1
104-
if: ${{ github.ref == 'refs/heads/master' }}
126+
if: ${{ github.ref == 'refs/heads/master' && env.create_release }}
105127
with:
106128
artifacts: "${{ github.workspace }}\\Release.zip"
107129
token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)