16
16
description : Create a draft release (for manually editing release notes before publishing).
17
17
type : boolean
18
18
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
23
20
dry_run :
24
21
description : Perform a dry-run release.
25
22
type : boolean
26
23
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
27
29
ignore_missing_commit_metadata :
28
30
description : WARNING! This option disables the requirement that all commits have a PR. Not needed for dry_run.
29
31
type : boolean
@@ -38,9 +40,7 @@ permissions:
38
40
id-token : write
39
41
40
42
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 }}
44
44
45
45
concurrency : ${{ github.workflow }}-${{ github.ref }}
46
46
@@ -76,25 +76,33 @@ jobs:
76
76
ref=HEAD
77
77
old_version="$(git describe --abbrev=0 "$ref^1")"
78
78
79
+ if [[ "${{ github.event.inputs.ignore_missing_commit_metadata }}" == *t* ]]; then
80
+ export CODER_IGNORE_MISSING_COMMIT_METADATA=1
81
+ fi
82
+
79
83
# Warn if CODER_IGNORE_MISSING_COMMIT_METADATA is set any other way
80
84
# than via dry-run.
81
85
if [[ ${CODER_IGNORE_MISSING_COMMIT_METADATA:-0} != 0 ]]; then
82
86
echo "WARNING: CODER_IGNORE_MISSING_COMMIT_METADATA is enabled and we will ignore missing commit metadata." 1>&2
83
87
fi
84
88
85
- if [[ $DRY_RUN == true ]]; then
89
+ version_args=()
90
+ if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
86
91
# Allow dry-run of branches to pass.
87
92
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
93
+ version_args+=(--dry-run)
88
94
fi
89
95
90
96
# Cache commit metadata.
91
97
. ./scripts/release/check_commit_metadata.sh "$old_version" "$ref"
92
98
99
+ declare -p version_args
100
+
93
101
# Create new release tag (note that this tag is not pushed before
94
102
# release.sh is run).
95
103
version="$(
96
104
./scripts/release/tag_version.sh \
97
- ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
105
+ "${version_args[@]}" \
98
106
--ref "$ref" \
99
107
--${{ github.event.inputs.increment }}
100
108
)"
@@ -222,9 +230,18 @@ jobs:
222
230
- name : Publish release
223
231
run : |
224
232
set -euo pipefail
233
+
234
+ publish_args=()
235
+ if [[ "${{ github.event.inputs.draft }}" == *t* ]]; then
236
+ publish_args+=(--draft)
237
+ fi
238
+ if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
239
+ publish_args+=(--dry-run)
240
+ fi
241
+ declare -p publish_args
242
+
225
243
./scripts/release/publish.sh \
226
- ${{ github.event.inputs.draft && '--draft' }} \
227
- ${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
244
+ "${publish_args[@]}" \
228
245
--release-notes-file "$CODER_RELEASE_NOTES_FILE" \
229
246
./build/*_installer.exe \
230
247
./build/*.zip \
@@ -246,6 +263,7 @@ jobs:
246
263
uses : " google-github-actions/setup-gcloud@v1"
247
264
248
265
- name : Publish Helm Chart
266
+ if : ${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot }}
249
267
run : |
250
268
set -euo pipefail
251
269
version="$(./scripts/version.sh)"
0 commit comments