@@ -39,11 +39,20 @@ permissions:
39
39
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
40
40
id-token : write
41
41
42
- env :
43
- CODER_RELEASE : ${{ !github.event.inputs.snapshot }}
44
-
45
42
concurrency : ${{ github.workflow }}-${{ github.ref }}
46
43
44
+ env :
45
+ # Use string semantics for negating the boolean, otherwise it will always
46
+ # be false. See https://github.com/actions/runner/issues/1483.
47
+ # Note that any time we need to do expressions, more than outputting the
48
+ # actual boolean value, it's safest to use `contains` because it casts the
49
+ # input to string, meaning we get the same behavior for true and 'true'.
50
+ # Boolean behavior differs between workflow_dispatch and workflow_call.
51
+ CODER_RELEASE : ${{ contains(github.event.inputs.snapshot, 'false') }}
52
+ CODER_RELEASE_INCREMENT : ${{ github.event.inputs.increment }}
53
+ CODER_RELEASE_DRAFT : ${{ github.event.inputs.draft }}
54
+ CODER_DRY_RUN : ${{ contains(github.event.inputs.dry_run, 'true') || contains(github.event.inputs.snapshot, 'true') }}
55
+
47
56
jobs :
48
57
release :
49
58
name : Create and publish
87
96
fi
88
97
89
98
version_args=()
90
- if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
99
+ if [[ $CODER_DRY_RUN == *t* ]]; then
91
100
# Allow dry-run of branches to pass.
92
101
export CODER_IGNORE_MISSING_COMMIT_METADATA=1
93
102
version_args+=(--dry-run)
@@ -104,7 +113,7 @@ jobs:
104
113
./scripts/release/tag_version.sh \
105
114
"${version_args[@]}" \
106
115
--ref "$ref" \
107
- --${{ github.event.inputs.increment }}
116
+ --"$CODER_RELEASE_INCREMENT"
108
117
)"
109
118
110
119
# Generate notes.
@@ -232,10 +241,10 @@ jobs:
232
241
set -euo pipefail
233
242
234
243
publish_args=()
235
- if [[ "${{ github.event.inputs.draft }}" == *t* ]]; then
244
+ if [[ $CODER_RELEASE_DRAFT == *t* ]]; then
236
245
publish_args+=(--draft)
237
246
fi
238
- if [[ "${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}" == *t* ]]; then
247
+ if [[ $CODER_DRY_RUN == *t* ]]; then
239
248
publish_args+=(--dry-run)
240
249
fi
241
250
declare -p publish_args
@@ -263,7 +272,8 @@ jobs:
263
272
uses : " google-github-actions/setup-gcloud@v1"
264
273
265
274
- name : Publish Helm Chart
266
- if : ${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot }}
275
+ # Do not publish helm charts for either dry run or snapshots.
276
+ if : ${{ contains(github.event.inputs.dry_run, 'false') && contains(github.event.inputs.snapshot, 'false') }}
267
277
run : |
268
278
set -euo pipefail
269
279
version="$(./scripts/version.sh)"
@@ -275,7 +285,7 @@ jobs:
275
285
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/index.yaml gs://helm.coder.com/v2
276
286
277
287
- name : Upload artifacts to actions (if dry-run or snapshot)
278
- if : ${{ github.event.inputs.dry_run || github.event.inputs.snapshot }}
288
+ if : ${{ contains( github.event.inputs.dry_run, 'true') || contains( github.event.inputs.snapshot, 'true') }}
279
289
uses : actions/upload-artifact@v2
280
290
with :
281
291
name : release-artifacts
0 commit comments