1 name: create-github-release
5 branches: [ macos-develop ]
8 # If set and is not empty or all whitespace, this should be the list of
9 # architectures to build into a universal binary. If not set, empty, or
10 # all whitespace, the default architecture for the combination of runner
11 # and hardware will be used.
12 UNIVERSAL_ARCHS: x86_64 arm64
13 # If set and is not empty or all whitespace, sets the name of the SDK to
14 # use. Otherwise the default SDK for the runner will be used. Want an
15 # SDK that can build all the architectures in UNIVERSAL_ARCHS. For valid
16 # values of the sdk name, look at the xcrun man page.
17 #SDK_OVERRIDE: macosx11.3
18 # Used as the name when uploading or downloading the artifact for passing
19 # configuration data from the Setup job to those dependent on it.
20 CONFIG_ARTIFACT: release-config
21 # Used as the path for the file with the configuration data passed from
22 # the Setup job to those dependent on it.
23 CONFIG_ARTIFACT_PATH: release-config.txt
24 # Used as the name when uploading or downloading the artifact for passing
25 # the name of the source archive.
26 SRC_ARTIFACT: release-src
27 # Used as the path for the file with the name of the source archive in it.
28 SRC_ARTIFACT_PATH: release-src.txt
29 # Used as the name when uploading or downloading the artifact holding
31 SRC_ARCHIVE_ARTIFACT: release-src-archive
32 # Used as the name when uploading or downloading the artifact for passing
33 # the name of the Mac archive for the English version.
34 MAC_ENGLISH_ARTIFACT: release-mac-en
35 # Used as the path for the file with the name of the Mac archive for the
36 # English version in it.
37 MAC_ENGLISH_ARTIFACT_PATH: release-mac-en.txt
38 # Used as the name when uploading or downloading the artifact holding
39 # the Mac archive for the English version.
40 MAC_ENGLISH_ARCHIVE_ARTIFACT: release-mac-en-archive
41 # Used as the name when uploading or downloading the artifact for passing
42 # the name of the Mac archive for the English version.
43 MAC_JAPANESE_ARTIFACT: release-mac-ja
44 # Used as the path for the file with the name of the Mac archive for the
45 # English version in it.
46 MAC_JAPANESE_ARTIFACT_PATH: release-mac-ja.txt
47 # Used as the name when uploading or downloading the artifact holding
48 # the Mac archive for the English version.
49 MAC_JAPANESE_ARCHIVE_ARTIFACT: release-mac-ja-archive
54 runs-on: ubuntu-latest
56 # Need commit history and tags to get the version so use 0 for
57 # fetch-depth. Don't need the submodule(s) here.
59 uses: actions/checkout@v3
63 - name: Extract Names from configure.ac
66 name=`sed -E -n -e 's/^[[:blank:]]*AC_INIT\([[:blank:]]*\\[?//p' configure.ac | tail -1 | cut -d ']' -f 1 | cut -d ',' -f 1`
67 echo "name=$name" >> $GITHUB_OUTPUT
68 cap=`echo $name | sed -E -e 's/^a/A/' -e 's/^b/B/' -e 's/^c/C/' -e 's/^d/D/' -e 's/^e/E/' -e 's/^f/F/' -e 's/^g/G/' -e 's/^h/H/' -e 's/^i/I/' -e 's/^j/J/' -e 's/^k/K/' -e 's/^l/L/' -e 's/^m/M/' -e 's/^n/N/' -e 's/^o/O/' -e 's/^p/P/' -e 's/^q/Q/' -e 's/^r/R/' -e 's/^s/S/' -e 's/^t/T/' -e 's/^u/U/' -e 's/^v/V/' -e 's/^w/W/' -e 's/^x/X/' -e 's/^y/Y/' -e 's/^z/Z/'`
69 echo "cap=$cap" >> $GITHUB_OUTPUT
71 - name: Set Release Version
74 verfile=src/system/angband-version.h
75 major=`sed -E -n -e 's/^[[:blank:]]*#define[[:blank:]]+H_VER_MAJOR[[:blank:]]+//p' "$verfile" | cut -d ' ' -f 1 | cut -f 1 | cut -d '/' -f 1`
76 minor=`sed -E -n -e 's/^[[:blank:]]*#define[[:blank:]]+H_VER_MINOR[[:blank:]]+//p' "$verfile" | cut -d ' ' -f 1 | cut -f 1 | cut -d '/' -f 1`
77 patch=`sed -E -n -e 's/^[[:blank:]]*#define[[:blank:]]+H_VER_PATCH[[:blank:]]+//p' "$verfile" | cut -d ' ' -f 1 | cut -f 1 | cut -d '/' -f 1`
78 extra=`sed -E -n -e 's/^[[:blank:]]*#define[[:blank:]]+H_VER_EXTRA[[:blank:]]+//p' "$verfile" | cut -d ' ' -f 1 | cut -f 1 | cut -d '/' -f 1`
79 version="$major"."$minor"."$patch"
81 if test x$extra != x0 ; then
82 version="${version}-Alpha${extra}"
83 tag="${tag}-alpha${extra}"
85 head=`git rev-parse --verify --short HEAD`
86 version="${version}-${head}"
88 if git diff-index --quiet HEAD ; then
91 version="$version"-dirty
94 echo "version=$version" >> $GITHUB_OUTPUT
95 echo "tag=$tag" >> $GITHUB_OUTPUT
97 echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
98 # Mark anything that isn't a prerelease as a draft.
100 if test x$prerelease = xtrue ; then
103 echo "draft=$draft" >> $GITHUB_OUTPUT
105 # The quoting here may be too simple-minded: what if there are single
106 # quotes in the steps.*.outputs.* stuff.
107 - name: Create Artifact with Configuration Details
109 echo name= '${{ steps.get_names.outputs.name }}' > $CONFIG_ARTIFACT_PATH
110 echo cap= '${{ steps.get_names.outputs.cap }}' >> $CONFIG_ARTIFACT_PATH
111 echo version= '${{ steps.get_release_vars.outputs.version }}' >> $CONFIG_ARTIFACT_PATH
112 echo tag= '${{ steps.get_release_vars.outputs.tag }}' >> $CONFIG_ARTIFACT_PATH
113 echo prerelease= '${{ steps.get_release_vars.outputs.prerelease }}' >> $CONFIG_ARTIFACT_PATH
114 echo draft= '${{ steps.get_release_vars.outputs.draft }}' >> $CONFIG_ARTIFACT_PATH
116 - name: Upload Artifact for Use by Dependent Steps
117 uses: actions/upload-artifact@v3
119 name: ${{ env.CONFIG_ARTIFACT }}
120 path: ${{ env.CONFIG_ARTIFACT_PATH }}
126 runs-on: ubuntu-latest
128 - name: Download Artifact with Configuration Information
129 uses: actions/download-artifact@v3
131 name: ${{ env.CONFIG_ARTIFACT }}
133 - name: Extract Configuration Information and Store in Step Outputs
136 name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
137 echo "name=$name" >> $GITHUB_OUTPUT
138 version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
139 echo "version=$version" >> $GITHUB_OUTPUT
141 - name: Install Build Dependencies
144 sudo apt-get install automake autoconf make tar gzip
146 - name: Clone Project
147 uses: actions/checkout@v3
151 - name: Create Source Archive
152 id: create_source_archive
154 out="${{ steps.store_config.outputs.name }}"-"${{ steps.store_config.outputs.version }}"
155 echo "archive_file=${out}.tar.gz" >> $GITHUB_OUTPUT
157 ./configure --disable-japanese --disable-net
159 mv "${{ steps.store_config.outputs.name }}"-* "$out"
160 tar -cBf - "$out" | gzip -c - >"$out".tar.gz
162 - name: Create Artifact with Source Archive Path
164 echo archive_path= '${{ steps.create_source_archive.outputs.archive_file }}' > $SRC_ARTIFACT_PATH
166 - name: Upload Artifact with Source Archive Path
167 uses: actions/upload-artifact@v3
169 name: ${{ env.SRC_ARTIFACT }}
170 path: ${{ env.SRC_ARTIFACT_PATH }}
173 - name: Upload Source Archive as Artifact
174 uses: actions/upload-artifact@v3
176 name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
177 path: ${{ steps.create_source_archive.outputs.archive_file }}
183 runs-on: macos-latest
185 - name: Download Artifact with Configuration Information
186 uses: actions/download-artifact@v3
188 name: ${{ env.CONFIG_ARTIFACT }}
190 - name: Extract Configuration Information and Store in Step Outputs
193 name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
194 echo "name=$name" >> $GITHUB_OUTPUT
195 cap=`sed -E -n -e 's/cap= //p' $CONFIG_ARTIFACT_PATH`
196 echo "cap=$cap" >> $GITHUB_OUTPUT
197 version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
198 echo "version=$version" >> $GITHUB_OUTPUT
200 - name: Clone Project
201 uses: actions/checkout@v3
205 # Requires automake and autoconf; install those via homebrew (available
207 - name: Install Build Dependencies
210 brew install autoconf
211 brew install automake
213 - name: Create Mac English Archive
214 id: create_mac_en_archive
216 if test -n `echo "${{ env.SDK_OVERRIDE }}" | tr -d ' \t\r\n'` ; then
217 SDKROOT=`echo "${{ env.SDK_OVERRIDE }}" | tr -d ' \t\r\n'`
225 DEPENDENCY_TRACKING=""
226 if test -n `echo "${{ env.UNIVERSAL_ARCHS }}" | tr -d ' \t\r\n'` ; then
227 DEPENDENCY_TRACKING="--disable-dependency-tracking --disable-pch"
228 # Include what configure normally infers for the compiler flags.
229 # Without -O2, the generated executables take painfully long to
230 # read the data files.
231 CFLAGS="$CFLAGS -g -O2"
232 CXXFLAGS="$CXXFLAGS -g -O2"
233 OBJCXXFLAGS="$OBJCXXFLAGS -g -O2"
234 for arch in ${{ env.UNIVERSAL_ARCHS }} ; do
236 CFLAGS="$CFLAGS $option"
237 CXXFLAGS="$CXXFLAGS $option"
238 OBJCXXFLAGS="$OBJCXXFLAGS $option"
239 LDFLAGS="$LDFLAGS $option"
241 echo "Performing a univeral build:"
242 echo " CFLAGS = $CFLAGS"
243 echo " CXXFLAGS = $CXXFLAGS"
244 echo " OBJCXXFLAGS = $OBJCXXFLAGS"
245 echo " LDFLAGS = $LDFLAGS"
247 env CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
248 OBJCXXFLAGS="$OBJCXXFLAGS" LDFLAGS="$LDFLAGS" \
249 ./configure --enable-cocoa --disable-japanese $DEPENDENCY_TRACKING
252 mv "${{ steps.store_config.outputs.name }}".app disttemp
253 hdiutil create -quiet -volname "${{ steps.store_config.outputs.cap }}-${{ steps.store_config.outputs.version }}-English" -srcfolder disttemp disttemp.dmg
254 archive_prefix="${{ steps.store_config.outputs.cap }}-${{ steps.store_config.outputs.version }}-English"
255 echo "archive_file=${archive_prefix}.dmg" >> $GITHUB_OUTPUT
256 hdiutil convert disttemp.dmg -quiet -format UDZO -imagekey zlib-level=6 -o "${archive_prefix}.dmg"
258 - name: Create Artifact with Mac English Archive Path
260 echo archive_path= '${{ steps.create_mac_en_archive.outputs.archive_file }}' > $MAC_ENGLISH_ARTIFACT_PATH
262 - name: Upload Artifact with Mac English Archive Path
263 uses: actions/upload-artifact@v3
265 name: ${{ env.MAC_ENGLISH_ARTIFACT }}
266 path: ${{ env.MAC_ENGLISH_ARTIFACT_PATH }}
269 - name: Upload Mac English Archive as Artifact
270 uses: actions/upload-artifact@v3
272 name: ${{ env.MAC_ENGLISH_ARCHIVE_ARTIFACT }}
273 path: ${{ steps.create_mac_en_archive.outputs.archive_file }}
279 runs-on: macos-latest
281 - name: Download Artifact with Configuration Information
282 uses: actions/download-artifact@v3
284 name: ${{ env.CONFIG_ARTIFACT }}
286 - name: Extract Configuration Information and Store in Step Outputs
289 name=`sed -E -n -e 's/name= //p' $CONFIG_ARTIFACT_PATH`
290 echo "name=$name" >> $GITHUB_OUTPUT
291 cap=`sed -E -n -e 's/cap= //p' $CONFIG_ARTIFACT_PATH`
292 echo "cap=$cap" >> $GITHUB_OUTPUT
293 version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
294 echo "version=$version" >> $GITHUB_OUTPUT
296 - name: Clone Project
297 uses: actions/checkout@v3
301 # Requires automake, autoconf, and nkf; install those via homebrew
302 # (available by default).
303 - name: Install Build Dependencies
306 brew install autoconf
307 brew install automake
310 - name: Create Mac Japanese Archive
311 id: create_mac_ja_archive
313 if test -n `echo "${{ env.SDK_OVERRIDE }}" | tr -d ' \t\r\n'` ; then
314 SDKROOT=`echo "${{ env.SDK_OVERRIDE }}" | tr -d ' \t\r\n'`
322 DEPENDENCY_TRACKING=""
323 if test -n `echo "${{ env.UNIVERSAL_ARCHS }}" | tr -d ' \t\r\n'` ; then
324 DEPENDENCY_TRACKING="--disable-dependency-tracking --disable-pch"
325 # Include what configure normally infers for the compiler flags.
326 # Without -O2, the generated executables take painfully long to
327 # read the data files.
328 CFLAGS="$CFLAGS -g -O2"
329 CXXFLAGS="$CXXFLAGS -g -O2"
330 OBJCXXFLAGS="$OBJCXXFLAGS -g -O2"
331 for arch in ${{ env.UNIVERSAL_ARCHS }} ; do
333 CFLAGS="$CFLAGS $option"
334 CXXFLAGS="$CXXFLAGS $option"
335 OBJCXXFLAGS="$OBJCXXFLAGS $option"
336 LDFLAGS="$LDFLAGS $option"
338 echo "Performing a univeral build:"
339 echo " CFLAGS = $CFLAGS"
340 echo " CXXFLAGS = $CXXFLAGS"
341 echo " OBJCXXFLAGS = $OBJCXXFLAGS"
342 echo " LDFLAGS = $LDFLAGS"
344 env CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
345 OBJCXXFLAGS="$OBJCXXFLAGS" LDFLAGS="$LDFLAGS" \
346 ./configure --enable-cocoa $DEPENDENCY_TRACKING
349 mv "${{ steps.store_config.outputs.name }}".app disttemp
350 hdiutil create -quiet -volname "${{ steps.store_config.outputs.cap }}-${{ steps.store_config.outputs.version}}-Japanese" -srcfolder disttemp disttemp.dmg
351 archive_prefix="${{ steps.store_config.outputs.cap }}-${{ steps.store_config.outputs.version }}-Japanese"
352 echo "archive_file=${archive_prefix}.dmg" >> $GITHUB_OUTPUT
353 hdiutil convert disttemp.dmg -quiet -format UDZO -imagekey zlib-level=6 -o "${archive_prefix}.dmg"
355 - name: Create Artifact with Mac Japanese Archive Path
357 echo archive_path= '${{ steps.create_mac_ja_archive.outputs.archive_file }}' > $MAC_JAPANESE_ARTIFACT_PATH
359 - name: Upload Artifact with Mac Japanese Archive Path
360 uses: actions/upload-artifact@v3
362 name: ${{ env.MAC_JAPANESE_ARTIFACT }}
363 path: ${{ env.MAC_JAPANESE_ARTIFACT_PATH }}
366 - name: Upload Mac Japanese Archive as Artifact
367 uses: actions/upload-artifact@v3
369 name: ${{ env.MAC_JAPANESE_ARCHIVE_ARTIFACT }}
370 path: ${{ steps.create_mac_ja_archive.outputs.archive_file }}
374 needs: [ setup, source, mac_en, mac_ja ]
375 name: Create GitHub Release
376 runs-on: ubuntu-latest
378 - name: Download Artifact with Configuration Information
379 uses: actions/download-artifact@v3
381 name: ${{ env.CONFIG_ARTIFACT }}
383 - name: Extract Configuration Information and Store in Step Outputs
386 version=`sed -E -n -e 's/version= //p' $CONFIG_ARTIFACT_PATH`
387 echo "version=$version" >> $GITHUB_OUTPUT
388 tag=`sed -E -n -e 's/tag= //p' $CONFIG_ARTIFACT_PATH`
389 echo "tag=$tag" >> $GITHUB_OUTPUT
390 prerelease=`sed -E -n -e 's/prerelease= //p' $CONFIG_ARTIFACT_PATH`
391 echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
392 draft=`sed -E -n -e 's/draft= //p' $CONFIG_ARTIFACT_PATH`
393 echo "draft=$draft" >> $GITHUB_OUTPUT
395 - name: Download Artifact with Source Archive Path
396 uses: actions/download-artifact@v3
398 name: ${{ env.SRC_ARTIFACT }}
400 - name: Extract Source Archive Path and Store in Step Outputs
403 archive_path=`sed -E -n -e 's/archive_path= //p' $SRC_ARTIFACT_PATH`
404 echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
406 - name: Download Artifact with Source Archive
407 uses: actions/download-artifact@v3
409 name: ${{ env.SRC_ARCHIVE_ARTIFACT }}
411 - name: Download Artifact with Mac English Archive Path
412 uses: actions/download-artifact@v3
414 name: ${{ env.MAC_ENGLISH_ARTIFACT }}
416 - name: Extract Mac English Archive Path and Store in Step Outputs
419 archive_path=`sed -E -n -e 's/archive_path= //p' $MAC_ENGLISH_ARTIFACT_PATH`
420 echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
422 - name: Download Artifact with Mac English Archive
423 uses: actions/download-artifact@v3
425 name: ${{ env.MAC_ENGLISH_ARCHIVE_ARTIFACT }}
427 - name: Download Artifact with Mac Japanese Archive Path
428 uses: actions/download-artifact@v3
430 name: ${{ env.MAC_JAPANESE_ARTIFACT }}
432 - name: Extract Mac Japanese Archive Path and Store in Step Outputs
435 archive_path=`sed -E -n -e 's/archive_path= //p' $MAC_JAPANESE_ARTIFACT_PATH`
436 echo "archive_path=$archive_path" >> $GITHUB_OUTPUT
438 - name: Download Artifact with Mac Japanese Archive
439 uses: actions/download-artifact@v3
441 name: ${{ env.MAC_JAPANESE_ARCHIVE_ARTIFACT }}
443 - name: Populate Release
444 uses: softprops/action-gh-release@v1
446 tag_name: "${{ steps.store_config.outputs.tag }}"
447 name: ${{ steps.store_config.outputs.version }}
448 target_commitish: ${{ github.sha }}
449 draft: ${{ steps.store_config.outputs.draft }}
450 prerelease: ${{ steps.store_config.outputs.prerelease }}
452 ${{ steps.store_src.outputs.archive_path }}
453 ${{ steps.store_mac_en.outputs.archive_path }}
454 ${{ steps.store_mac_ja.outputs.archive_path }}
455 token: ${{ secrets.GITHUB_TOKEN }}