Skip to content

Scripting: Added tiled.load to load assets without opening an editor #1965

Scripting: Added tiled.load to load assets without opening an editor

Scripting: Added tiled.load to load assets without opening an editor #1965

Workflow file for this run

name: Build Packages
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- 'appveyor.yml'
- '.travis.yml'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
- 'appveyor.yml'
- '.travis.yml'
env:
QBS_VERSION: 2.2.1
SENTRY_VERSION: 0.6.7
SENTRY_ORG: mapeditor
SENTRY_PROJECT: tiled
TILED_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}
TILED_SNAPSHOT: ${{ !startsWith(github.ref, 'refs/tags/v') }}
jobs:
version:
name: Determine Tiled version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
release: ${{ steps.get-version.outputs.release }}
steps:
- name: Get version
id: get-version
run: |
if [[ "$TILED_RELEASE" == 'true' ]]; then echo "version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT ; fi
if [[ "$TILED_RELEASE" != 'true' ]]; then echo "version=$(date "+%Y.%m.%d")" >> $GITHUB_OUTPUT ; fi
echo "release=${TILED_RELEASE}" >> $GITHUB_OUTPUT
linux:
name: Linux (AppImage, Qt ${{ matrix.qt_version_major }})
runs-on: ubuntu-20.04
needs: version
strategy:
matrix:
include:
- qt_version: 5.15.2
qt_version_major: 5
- qt_version: 6.6.1
qt_version_major: 6
env:
TILED_VERSION: ${{ needs.version.outputs.version }}
QT_VERSION: ${{ matrix.qt_version }}
QTCREATOR_VERSION: 12.0.1
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install \
libcurl4-openssl-dev \
libgl1-mesa-dev \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xinerama0 \
libxkbcommon-x11-0 \
libzstd-dev
- name: Install Qt
run: |
./dist/install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qtsvg qtimageformats qttools qttranslations icu | tee -a $GITHUB_PATH
./dist/install-qt.sh --version ${QTCREATOR_VERSION} qtcreator | tee -a $GITHUB_PATH
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
max-size: 250M
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: '3.19'
- name: Setup Qbs
run: |
qbs --version
qbs setup-toolchains --detect
qbs config defaultProfile x86_64-linux-gnu-gcc-10
- name: Build Sentry Native
run: |
curl -sLO https://github.com/getsentry/sentry-native/releases/download/${SENTRY_VERSION}/sentry-native.zip
mkdir sentry-native
pushd sentry-native
unzip -q ../sentry-native.zip
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel
sudo cmake --install build --prefix /usr --config RelWithDebInfo
popd
- name: Build Tiled
run: |
qbs install --install-root AppDir config:release qbs.installPrefix:/usr projects.Tiled.sentry:true qbs.debugInformation:true modules.cpp.separateDebugInformation:true modules.cpp.compilerWrapper:ccache
- name: Upload symbols and sources to Sentry
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli upload-dif --include-sources src .
- name: Build AppImage
run: |
cp LICENSE* COPYING *md AppDir/
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod +x linuxdeploy*.AppImage
export EXTRA_QT_PLUGINS=svg
export LD_LIBRARY_PATH=/opt/Qt/${QT_VERSION}/gcc_64/lib:$PWD/AppDir/usr/lib
export OUTPUT=Tiled-Qt${{ matrix.qt_version_major }}-x86_64.AppImage
# Avoid shipping the debug information
find AppDir -name \*.debug -delete
./linuxdeploy-x86_64.AppImage --appdir AppDir --custom-apprun=dist/linux/AppRun --exclude-library "*libpython3*" --plugin qt
# We don't need the bearer plugins (needed for Qt 5 only)
rm -rfv AppDir/usr/plugins/bearer
./linuxdeploy-x86_64.AppImage --appdir AppDir --custom-apprun=dist/linux/AppRun --exclude-library "*libpython3*" --output appimage
- name: Upload Tiled.AppImage
uses: actions/upload-artifact@v3
with:
name: Tiled-Qt${{ matrix.qt_version_major }}-x86_64.AppImage
path: Tiled-Qt${{ matrix.qt_version_major }}-x86_64.AppImage
snap:
name: Linux (snap)
runs-on: ubuntu-latest
needs: version
env:
TILED_VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Tiled version
id: version
run: |
sed -i 's/^version: .*/version: '"${TILED_VERSION}"'/g' snap/snapcraft.yaml
if [[ "$TILED_RELEASE" == 'true' ]]; then echo "snap_channel=candidate" >> $GITHUB_OUTPUT ; fi
if [[ "$TILED_RELEASE" != 'true' ]]; then echo "snap_channel=beta" >> $GITHUB_OUTPUT ; fi
- name: Build snap
id: build
uses: snapcore/action-build@v1
- name: Upload snap artifact
uses: actions/upload-artifact@v3
with:
name: tiled_amd64.snap
path: tiled_*_amd64.snap
- name: Release snap (beta channel)
uses: snapcore/action-publish@master
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push' && (github.ref == 'refs/heads/snapshot' || needs.version.outputs.release == 'true')
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: ${{ steps.version.outputs.snap_channel }}
macos:
name: macOS (${{ matrix.version_suffix }})
runs-on: macos-11
needs: version
strategy:
matrix:
include:
- qt_version: 5.12.12
version_suffix: "10.12-10.15"
architectures: x86_64
- qt_version: 6.6.1
version_suffix: "11+"
architectures: x86_64,arm64
env:
TILED_VERSION: ${{ needs.version.outputs.version }}
QT_VERSION: ${{ matrix.qt_version }}
QTCREATOR_VERSION: 12.0.1
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Qt
run: |
sudo ./dist/install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qtsvg qtimageformats qttools | tee -a $GITHUB_PATH
sudo ./dist/install-qt.sh --version ${QTCREATOR_VERSION} qtcreator | tee -a $GITHUB_PATH
- name: Setup Qbs
run: |
qbs setup-toolchains --detect
qbs config defaultProfile xcode
- name: Build Zstandard
run: |
git clone --depth 1 -b master https://github.com/facebook/zstd.git
pushd zstd/lib
CFLAGS="-arch arm64 -arch x86_64" make libzstd.a
popd
- name: Build Tiled
run: |
qbs install --install-root install config:release qbs.architectures:${{ matrix.architectures }} qbs.installPrefix:"" projects.Tiled.staticZstd:true
- name: Deploy Qt
run: |
macdeployqt install/Tiled.app -verbose=2
rm -f install/Tiled.app/Contents/PlugIns/tls/libqopensslbackend.dylib
pushd install
ruby ../dist/macos/fixup-install-names.rb
- name: Create Certificate File
id: certificateFile
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push'
uses: timheuer/base64-to-file@v1
with:
fileName: 'certificate.p12'
encodedString: ${{ secrets.MACOS_CERTIFICATE }}
- name: Import Certificate
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push'
run: |
security create-keychain -p ${{ secrets.KEYCHAIN_PWD }} mapeditor/tiled
security default-keychain -s mapeditor/tiled
security unlock-keychain -p ${{ secrets.KEYCHAIN_PWD }} mapeditor/tiled
security -q import ${{ steps.certificateFile.outputs.filePath }} -f pkcs12 -k mapeditor/tiled -P ${{ secrets.MACOS_CERTIFICATE_PWD }} -T /usr/bin/codesign -x
security set-key-partition-list -S 'apple-tool:,apple:' -s -k ${{ secrets.KEYCHAIN_PWD }} mapeditor/tiled
- name: Sign, Notarize & Staple
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push'
run: |
codesign --deep --force --verify --verbose --sign Lindeijer --options runtime install/Tiled.app
ditto -c -k --sequesterRsrc --keepParent install/Tiled.app Tiled_for_notarization.zip
xcrun notarytool submit --apple-id ${{ secrets.NOTARIZATION_USERNAME }} --password ${{ secrets.NOTARIZATION_PASSWORD }} --team-id ${{ secrets.NOTARIZATION_TEAM }} --wait Tiled_for_notarization.zip
xcrun stapler staple install/Tiled.app
- name: Create Archive
run: |
ditto -c -k --sequesterRsrc --keepParent install/Tiled.app Tiled_macOS-${{ matrix.version_suffix }}.zip
- name: Upload Tiled.app
uses: actions/upload-artifact@v3
with:
name: Tiled_macOS-${{ matrix.version_suffix }}.app
path: Tiled_macOS-${{ matrix.version_suffix }}.zip
windows:
name: Windows (${{ matrix.arch }}-bit, Qt ${{ matrix.qt_version_major }})
runs-on: windows-2019
needs: version
strategy:
matrix:
include:
- qt_version: 5.15.2
qt_version_major: 5
qt_toolchain: win32_mingw81
arch: 32
openssl_arch: x86
mingw_version: 8.1.0
mingw_component: mingw
mingw_path: /c/Qt/Tools/mingw810_32/bin
- qt_version: 6.6.1
qt_version_major: 6
qt_toolchain: win64_mingw
arch: 64
openssl_arch: x64
mingw_version: 9.0.0
mingw_component: mingw90
mingw_path: /c/Qt/Tools/mingw1120_64/bin
env:
TILED_VERSION: ${{ needs.version.outputs.version }}
MINGW_PATH: ${{ matrix.mingw_path }}
OPENSSL_VERSION: 1.1.1
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Qt
run: |
echo "QT_PATH=$(./dist/install-qt.sh --version ${{ matrix.qt_version }} --toolchain ${{ matrix.qt_toolchain }} qtbase qtdeclarative qtsvg qtimageformats qttools qttranslations)" >> $GITHUB_ENV
./dist/install-qt.sh --version ${{ matrix.mingw_version }} --toolchain win${{ matrix.arch }}_mingw ${{ matrix.mingw_component }}
echo "OPENSSL_PATH=$(./dist/install-qt.sh --version ${OPENSSL_VERSION} openssl --arch ${{ matrix.openssl_arch }})" >> $GITHUB_ENV
- name: Install Qbs
run: |
choco install -y qbs --version ${QBS_VERSION}
- name: Setup Qbs
run: |
qbs setup-toolchains ${MINGW_PATH}/*-w64-mingw32-gcc.exe mingw
qbs setup-qt ${QT_PATH}/qmake.exe qt
qbs config defaultProfile qt
- name: Build Zstandard
run: |
export PATH="${MINGW_PATH}:$PATH"
git clone --depth 1 -b master https://github.com/facebook/zstd.git
pushd zstd/lib
CC=gcc mingw32-make -j2 libzstd.a
popd
- name: Build Tiled
run: |
export TILED_MSI_VERSION=1.4.${GITHUB_RUN_NUMBER}
qbs build config:release projects.Tiled.windowsInstaller:true projects.Tiled.staticZstd:true
mv release/installer*/Tiled-*.msi .
- name: Upload Tiled installer
uses: actions/upload-artifact@v3
with:
name: Tiled-win${{ matrix.arch }}.msi
path: Tiled-*.msi
- name: Upload Tiled archive
uses: actions/upload-artifact@v3
with:
name: Tiled-win${{ matrix.arch }}
path: release/install-root/*
github:
name: Upload to GitHub releases
runs-on: ubuntu-latest
needs: [version, linux, macos, windows]
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push' && needs.version.outputs.release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Tiled ${{ needs.version.outputs.version }}
draft: true
prerelease: false
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Upload Windows 64-bit installer
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled-win64.msi/Tiled-${{ needs.version.outputs.version }}-win64.msi
asset_name: Tiled-${{ needs.version.outputs.version }}_Windows-10+_x86_64.msi
asset_content_type: application/x-msi
- name: Upload Windows 32-bit installer
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled-win32.msi/Tiled-${{ needs.version.outputs.version }}-win32.msi
asset_name: Tiled-${{ needs.version.outputs.version }}_Windows-7-8_x86.msi
asset_content_type: application/x-msi
- name: Upload Linux AppImage (Qt5)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled-Qt5-x86_64.AppImage/Tiled-Qt5-x86_64.AppImage
asset_name: Tiled-${{ needs.version.outputs.version }}_Linux_Qt-5_x86_64.AppImage
asset_content_type: application/vnd.appimage
- name: Upload Linux AppImage (Qt6)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled-Qt6-x86_64.AppImage/Tiled-Qt6-x86_64.AppImage
asset_name: Tiled-${{ needs.version.outputs.version }}_Linux_Qt-6_x86_64.AppImage
asset_content_type: application/vnd.appimage
- name: Upload macOS app (10.12-10.15)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled_macOS-10.12-10.15.app/Tiled_macOS-10.12-10.15.zip
asset_name: Tiled-${{ needs.version.outputs.version }}_macOS-10.12-10.15.zip
asset_content_type: application/zip
- name: Upload macOS app (11+)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Tiled_macOS-11+.app/Tiled_macOS-11+.zip
asset_name: Tiled-${{ needs.version.outputs.version }}_macOS-11+.zip
asset_content_type: application/zip
sentry:
name: Create Sentry release
runs-on: ubuntu-latest
needs: [version, linux, macos, windows]
if: github.repository == 'mapeditor/tiled' && github.event_name == 'push' && needs.version.outputs.release == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: releases
version: tiled@${{ needs.version.outputs.version }}