Files
@ r27968:8d39088f27c4
Branch filter:
Location: cpp/openttd-patchpack/source/.github/workflows/release-macos.yml
r27968:8d39088f27c4
7.1 KiB
text/x-yaml
Update: Translations from eints
chinese (simplified): 139 changes by BYXxiaonanhui
catalan: 23 changes by J0anJosep
portuguese (brazilian): 1 change by pasantoro
chinese (simplified): 139 changes by BYXxiaonanhui
catalan: 23 changes by J0anJosep
portuguese (brazilian): 1 change by pasantoro
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | name: Release (MacOS)
on:
workflow_call:
inputs:
survey_key:
required: false
type: string
default: ""
jobs:
macos:
name: MacOS
runs-on: macos-11
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
steps:
- name: Download source
uses: actions/download-artifact@v3
with:
name: internal-source
- name: Unpack source
run: |
tar -xf source.tar.gz --strip-components=1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
- name: Install dependencies
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
echo "::group::Install brew dependencies"
brew install \
pandoc \
pkg-config \
# EOF
echo "::endgroup::"
echo "::group::Install breakpad dependencies"
cargo install dump_syms
echo "::endgroup::"
- name: Prepare cache key
id: key
run: |
echo "image=$ImageOS-$ImageVersion" >> $GITHUB_OUTPUT
- name: Enable vcpkg cache
uses: actions/cache@v3
with:
path: /usr/local/share/vcpkg/installed
key: ${{ steps.key.outputs.image }}-vcpkg-release-1 # Increase the number whenever dependencies are modified
restore-keys: |
${{ steps.key.outputs.image }}-vcpkg-release
${{ steps.key.outputs.image }}-vcpkg-x64
- name: Prepare vcpkg
run: |
vcpkg install \
breakpad:x64-osx \
breakpad:arm64-osx \
curl:x64-osx \
curl:arm64-osx \
liblzma:x64-osx \
liblzma:arm64-osx \
libpng:x64-osx \
libpng:arm64-osx \
lzo:x64-osx \
lzo:arm64-osx \
zlib:x64-osx \
zlib:arm64-osx \
# EOF
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build tools
run: |
mkdir build-host
cd build-host
echo "::group::CMake"
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_TOOLS_ONLY=ON \
# EOF
echo "::endgroup::"
echo "::group::Build tools"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools
echo "::endgroup::"
- name: Import code signing certificates
uses: Apple-Actions/import-codesign-certs@v2
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
# If this is run on a fork, there may not be a certificate set up - continue in this case
continue-on-error: true
- name: Build arm64
run: |
mkdir build-arm64
cd build-arm64
echo "::group::CMake"
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DVCPKG_TARGET_TRIPLET=arm64-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
# EOF
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
echo "::endgroup::"
- name: Build x64
run: |
mkdir build-x64
cd build-x64
echo "::group::CMake"
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DVCPKG_TARGET_TRIPLET=x64-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
-DCPACK_BUNDLE_APPLE_CERT_APP=${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }} \
"-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime" \
-DAPPLE_UNIVERSAL_PACKAGE=1 \
# EOF
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
echo "::endgroup::"
- name: Create breakpad symbols
run: |
cd build-x64
mkdir dSYM
dsymutil ./openttd -o dSYM/openttd
dump_syms ./dSYM/openttd --inlines --store symbols
cd ../build-arm64
mkdir dSYM
dsymutil ./openttd -o dSYM/openttd
dump_syms ./dSYM/openttd --inlines --store ../build-x64/symbols
- name: Create bundles
run: |
cd build-x64
echo "::group::Create universal binary"
# Combine the `openttd` binaries from each build into a single file
lipo -create -output openttd-universal ../build-*/openttd
mv openttd-universal openttd
echo "::endgroup::"
echo "::group::Run CPack"
cpack
echo "::endgroup::"
echo "::group::Cleanup"
# Remove the sha256 files CPack generates; we will do this ourself at
# the end of this workflow.
rm -f bundles/*.sha256
echo "::endgroup::"
- name: Notarize
env:
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_APP_USERNAME }}
AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APP_PASSWORD }}
AC_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
run: |
if [ -z "${AC_USERNAME}" ]; then
# We may be running on a fork that doesn't have notarization secrets set up; skip this step
echo No notarization secrets set up, skipping.
exit 0
fi
xcrun notarytool store-credentials --apple-id "${AC_USERNAME}" --password "${AC_PASSWORD}" --team-id "${AC_TEAM_ID}" openttd
cd build-x64
../os/macosx/notarize.sh
- name: Build zip
run: |
cd build-x64
pushd _CPack_Packages/*/Bundle/openttd-*/
# Remove the Applications symlink from the staging folder
rm -f Applications
# Remove the original dmg built by CPack to avoid a conflict when resolving
# the zip_filename variable below
rm -f ../*.dmg
zip_filename=(../openttd-*)
# Package up the existing, notarised .app into a zip file
zip -r -9 ${zip_filename}.zip OpenTTD.app
popd
# Now move it into place to be uploaded
mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
- name: Store bundles
uses: actions/upload-artifact@v3
with:
name: openttd-macos-universal
path: build-x64/bundles
retention-days: 5
- name: Store symbols
uses: actions/upload-artifact@v3
with:
name: symbols-macos-universal
path: build-x64/symbols
retention-days: 5
|