@@ -59,6 +59,21 @@ if [[ "$version" == "" ]]; then
59
59
version=" $( execrelative ./version.sh) "
60
60
fi
61
61
62
+ # realpath-ify all input files so we can cdroot below.
63
+ files=()
64
+ for f in " $@ " ; do
65
+ if [[ ! -e " $f " ]]; then
66
+ error " File not found: $f "
67
+ fi
68
+ files+=(" $( realpath " $f " ) " )
69
+ done
70
+ if [[ " ${# files[@]} " == 0 ]]; then
71
+ error " No files supplied"
72
+ fi
73
+
74
+ # The git commands need to be executed from within the repository.
75
+ cdroot
76
+
62
77
# Verify that we're currently checked out on the supplied tag.
63
78
new_tag=" v$version "
64
79
if [[ " $( git describe --always) " != " $new_tag " ]]; then
@@ -80,24 +95,26 @@ if [[ "$dry_run" == 1 ]]; then
80
95
fi
81
96
82
97
# Craft the release notes.
98
+ changelog=" $( git log --no-merges --pretty=format:" - %h %s" " $changelog_range " ) "
99
+ image_tag=" $( execrelative ./image_tag.sh --version " $version " ) "
83
100
release_notes="
84
101
## Changelog
85
102
86
- $( git log --no-merges --pretty=format: " - %h %s " " $changelog_range " )
103
+ $changelog
87
104
88
105
## Container Image
89
- - \` docker pull $( execrelative ./ image_tag.sh --version " $version " ) \`
106
+ - \` docker pull $image_tag \`
90
107
91
108
"
92
109
93
- # Create temporary release folder so we can generate checksums.
110
+ # Create temporary release folder so we can generate checksums. Both the
111
+ # sha256sum and gh binaries support symlinks as input files so this works well.
94
112
temp_dir=" $( mktemp -d) "
95
- for f in " $@ " ; do
96
- ln -s " $( realpath " $f " ) " " $temp_dir /"
113
+ for f in " ${files[@]} " ; do
114
+ ln -s " $f " " $temp_dir /"
97
115
done
98
116
99
- # Generate checksums file. sha256sum seems to play nicely with symlinks so this
100
- # works well.
117
+ # Generate checksums file which will be uploaded to the GitHub release.
101
118
pushd " $temp_dir "
102
119
sha256sum ./* | sed -e ' s/\.\///' - > " coder_${version} _checksums.txt"
103
120
popd
116
133
117
134
# We echo the release notes in instead of writing to a file and referencing that
118
135
# to prevent GitHub CLI from becoming interactive.
119
- #
120
- # GitHub CLI seems to follow symlinks when uploading files.
121
136
echo " $release_notes " |
122
137
maybedryrun " $dry_run " gh release create \
123
138
--title " $new_tag " \
0 commit comments