Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e9af7f

Browse files
committed
ci: Fix release workflow inputs
1 parent c0d9e32 commit 8e9af7f

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

.github/workflows/release.yaml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ on:
1616
description: Create a draft release (for manually editing release notes before publishing).
1717
type: boolean
1818
required: true
19-
snapshot:
20-
description: Force a dev version to be generated, implies dry_run.
21-
type: boolean
22-
required: true
19+
default: false
2320
dry_run:
2421
description: Perform a dry-run release.
2522
type: boolean
2623
required: true
24+
default: false
25+
snapshot:
26+
description: Force a dev version to be generated, implies dry_run.
27+
type: boolean
28+
default: false
2729
ignore_missing_commit_metadata:
2830
description: WARNING! This option disables the requirement that all commits have a PR. Not needed for dry_run.
2931
type: boolean
@@ -38,9 +40,7 @@ permissions:
3840
id-token: write
3941

4042
env:
41-
CODER_RELEASE: ${{ github.event.inputs.snapshot && 'false' || 'true' }}
42-
DRY_RUN: ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && 'true' || 'false' }}
43-
CODER_IGNORE_MISSING_COMMIT_METADATA: ${{ github.event.inputs.ignore_missing_commit_metadata && '1' || '0' }}
43+
CODER_RELEASE: ${{ !github.event.inputs.snapshot }}
4444

4545
concurrency: ${{ github.workflow }}-${{ github.ref }}
4646

@@ -76,15 +76,21 @@ jobs:
7676
ref=HEAD
7777
old_version="$(git describe --abbrev=0 "$ref^1")"
7878
79+
if [[ "${{ github.event.inputs.ignore_missing_commit_metadata }}" == *t* ]]; then
80+
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
81+
fi
82+
7983
# Warn if CODER_IGNORE_MISSING_COMMIT_METADATA is set any other way
8084
# than via dry-run.
8185
if [[ ${CODER_IGNORE_MISSING_COMMIT_METADATA:-0} != 0 ]]; then
8286
echo "WARNING: CODER_IGNORE_MISSING_COMMIT_METADATA is enabled and we will ignore missing commit metadata." 1>&2
8387
fi
8488
85-
if [[ $DRY_RUN == true ]]; then
89+
version_args=()
90+
if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
8691
# Allow dry-run of branches to pass.
8792
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
93+
version_args+=(--dry-run)
8894
fi
8995
9096
# Cache commit metadata.
@@ -94,7 +100,7 @@ jobs:
94100
# release.sh is run).
95101
version="$(
96102
./scripts/release/tag_version.sh \
97-
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
103+
"${version_args[@]}" \
98104
--ref "$ref" \
99105
--${{ github.event.inputs.increment }}
100106
)"
@@ -222,9 +228,17 @@ jobs:
222228
- name: Publish release
223229
run: |
224230
set -euo pipefail
231+
232+
args=()
233+
if [[ "${{ github.event.inputs.draft }}" == *t* ]]; then
234+
args+=(--draft)
235+
fi
236+
if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
237+
args+=(--dry_run)
238+
fi
239+
225240
./scripts/release/publish.sh \
226-
${{ github.event.inputs.draft && '--draft' }} \
227-
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
241+
"${args[@]}" \
228242
--release-notes-file "$CODER_RELEASE_NOTES_FILE" \
229243
./build/*_installer.exe \
230244
./build/*.zip \
@@ -246,6 +260,7 @@ jobs:
246260
uses: "google-github-actions/setup-gcloud@v1"
247261

248262
- name: Publish Helm Chart
263+
if: ${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot }}
249264
run: |
250265
set -euo pipefail
251266
version="$(./scripts/version.sh)"

scripts/release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ if ! [[ $create =~ ^[Yy]$ ]]; then
147147
fi
148148

149149
args=()
150+
151+
# Draft and dry-run are required args.
150152
if ((draft)); then
151153
args+=(-F draft=true)
152154
else
@@ -168,7 +170,6 @@ log
168170
gh workflow run release.yaml \
169171
--ref "$branch" \
170172
-F increment="$increment" \
171-
-F snapshot=false \
172173
"${args[@]}"
173174
log
174175

0 commit comments

Comments
 (0)