Merge pull request #1 from FrankMerriman/main #211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy Aseprite | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
run_fetch: | |
description: 'Run fetch-aseprite-info job?' | |
required: false | |
default: 'true' | |
run_create: | |
description: 'Run create-release job?' | |
required: false | |
default: 'true' | |
run_build: | |
description: 'Run build-aseprite job?' | |
required: false | |
default: 'true' | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
fetch-aseprite-info: | |
name: Fetch deps info | |
if: > | |
github.event_name != 'workflow_dispatch' | |
|| github.event.inputs.run_fetch == 'true' | |
runs-on: ubuntu-latest | |
outputs: | |
download-link: ${{ steps.aseprite-link.outputs.download-link }} | |
release-tag: ${{ steps.aseprite-link.outputs.release-tag }} | |
steps: | |
- name: Fetch Aseprite release link | |
id: aseprite-link | |
uses: a1393323447/fetch-release@main | |
with: | |
group: aseprite | |
repo: aseprite | |
match: Aseprite-.*?-Source.zip | |
create-release: | |
name: Create Release | |
needs: fetch-aseprite-info | |
if: > | |
needs.fetch-aseprite-info.result == 'success' | |
&& (github.event_name != 'workflow_dispatch' | |
|| github.event.inputs.run_create == 'true') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
download-link: ${{ needs.fetch-aseprite-info.outputs.download-link }} | |
release-tag: ${{ needs.fetch-aseprite-info.outputs.release-tag }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.fetch-aseprite-info.outputs.release-tag }} | |
body: Aseprite-${{ needs.fetch-aseprite-info.outputs.release-tag }} | |
skipIfReleaseExists: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build-aseprite: | |
name: Build Aseprite | |
needs: create-release | |
if: > | |
needs.create-release.result == 'success' | |
&& (github.event_name != 'workflow_dispatch' | |
|| github.event.inputs.run_build == 'true') | |
permissions: | |
contents: write | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macOS-latest] | |
fail-fast: false | |
steps: | |
- name: Install Dependencies (Linux) | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y \ | |
libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \ | |
libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev | |
- name: Install Dependencies (macOS) | |
if: runner.os == 'macOS-latest' | |
run: brew install ninja p7zip jpeg-turbo wget | |
- uses: actions/checkout@v4 | |
- name: Install Aseprite | |
shell: bash | |
run: | | |
git clone --recurse-submodules -j8 \ | |
https://github.com/aseprite/aseprite \ | |
--branch ${{ needs.create-release.outputs.release-tag }} aseprite | |
- name: Install Skia | |
working-directory: aseprite | |
shell: bash | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
choco install wget -y --no-progress | |
wget https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-Windows-Release-x64.zip | |
unzip Skia-Windows-Release-x64.zip -d skia | |
elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
wget https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-macOS-Release-arm64.zip | |
unzip Skia-macOS-Release-arm64.zip -d skia | |
else | |
wget https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-Linux-Release-x64.zip | |
unzip Skia-Linux-Release-x64.zip -d skia | |
fi | |
- uses: aseprite/get-ninja@main | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: runner.os == 'Windows' | |
- name: Generating Makefiles | |
shell: bash | |
working-directory: aseprite | |
run: | | |
enable_ccache=off | |
laf_backend=skia | |
enable_scripting=on | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
skia_arch=arm64 | |
else | |
skia_arch=x64 | |
fi | |
cmake -S . -B build -G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ | |
-DENABLE_TESTS=OFF \ | |
-DENABLE_SCRIPTING=$enable_scripting \ | |
-DENABLE_CCACHE=$enable_ccache \ | |
-DLAF_BACKEND=$laf_backend \ | |
-DSKIA_DIR=$(realpath skia) \ | |
-DSKIA_LIBRARY_DIR=$(realpath skia/out/Release-$skia_arch) | |
- name: Compiling | |
shell: bash | |
working-directory: aseprite | |
run: ninja -C build | |
- name: Clean Up Build folder | |
shell: bash | |
working-directory: aseprite/build/bin | |
run: find . -mindepth 1 ! \( -name 'aseprite' -o -name 'aseprite.exe' -o -name 'data' -prune \) -exec rm -rf {} + | |
- name: Make portable zip | |
working-directory: aseprite/build/bin | |
run: echo '# This file is here so Aseprite behaves as a portable program' > aseprite.ini | |
- name: Download and extract OpenSSL DLLs (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
working-directory: aseprite/build/bin | |
run: | | |
# Download the zip from https://wiki.overbyte.eu/wiki/index.php/ICS_Download | |
# This binary provider comes from a suggested 3rd party list on the official opensll github | |
Invoke-WebRequest -Uri "https://wiki.overbyte.eu/arch/openssl-1.1.1w-win64.zip" -OutFile dlls.zip | |
# Extract dlls into same path as the .exe | |
Expand-Archive -Path dlls.zip -DestinationPath temp_dlls | |
Copy-Item temp_dlls\libcrypto-1_1-x64.dll . | |
Copy-Item temp_dlls\libssl-1_1-x64.dll . | |
# Remove the ssl zip + temp folder from the final release | |
Remove-Item -Recurse -Force temp_dlls | |
Remove-Item dlls.zip | |
- name: Create macOS .app bundle | |
if: runner.os == 'macOS' | |
shell: bash | |
working-directory: aseprite/build/bin | |
run: | | |
mkdir -p Aseprite.app/Contents/MacOS | |
mkdir -p Aseprite.app/Contents/Resources | |
# Move the built binary into the app bundle | |
mv aseprite Aseprite.app/Contents/MacOS/ | |
mv data Aseprite.app/Contents/Resources/ | |
# Don't know if ini is needed on mac | |
mv aseprite.ini Aseprite.app/Contents/Resources/ | |
# Create app icns | |
mkdir -p Aseprite.iconset | |
for file in Aseprite.app/Contents/Resources/data/icons/ase*.png; do | |
num=$(basename "$file" | grep -E -o "\d+") | |
if (( num % 16 == 0 )); then | |
cp "$file" "Aseprite.iconset/icon_${num}x${num}.png" | |
fi | |
done | |
iconutil -c icns Aseprite.iconset | |
rm -R Aseprite.iconset | |
mv Aseprite.icns Aseprite.app/Contents/Resources/ | |
# Create minimal Info.plist | |
cat > Aseprite.app/Contents/Info.plist <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleExecutable</key> | |
<string>aseprite</string> | |
<key>CFBundleIdentifier</key> | |
<string>org.aseprite.app</string> | |
<key>CFBundleName</key> | |
<string>Aseprite</string> | |
<key>CFBundleVersion</key> | |
<string>${{ needs.create-release.outputs.release-tag }}</string> | |
<key>CFBundlePackageType</key> | |
<string>APPL</string> | |
<key>CFBundleIconFile</key> | |
<string>Aseprite.icns</string> | |
</dict> | |
</plist> | |
EOF | |
- name: Create release (macOS) | |
if: runner.os == 'macOS' | |
shell: bash | |
working-directory: aseprite/build/bin | |
run: | | |
# Create the folder to hold the .app and the helper script | |
mkdir AsepriteBundle | |
mv Aseprite.app AsepriteBundle/ | |
# Need to overcome mac security for external unsigned apps | |
# https://github.com/electron-userland/electron-builder/issues/8191 | |
cat << 'EOF' > AsepriteBundle/README.md | |
# Fixing "damaged and can't be opened" on macOS | |
If you see an error saying Aseprite is “damaged and can’t be opened,” this is caused by macOS quarantine flags applied when downloading from the internet. | |
Follow these steps to fix it: | |
1. Open Terminal: | |
- Press Command + Spacebar | |
- Type "Terminal" and press Enter | |
2. In the Terminal window, type the word `cd` followed by a space, then drag the folder containing this app into the Terminal window. This will insert the folder path. | |
Example: | |
cd /Users/yourname/Downloads/AsepriteBundle | |
3. Press Enter | |
4. Copy and paste the following line | |
xattr -rd com.apple.quarantine Aseprite.app | |
5. Press Enter | |
After that, you should be able to double-click Aseprite.app and open it normally. | |
You only need to do this once after downloading. | |
EOF | |
# Create the zip, preserving metadata | |
ditto -c -k --sequesterRsrc --keepParent AsepriteBundle Aseprite-${{ needs.create-release.outputs.release-tag }}-${{ runner.os }}.zip | |
- name: Create release (Linux + Windows) | |
if: runner.os != 'macOS' | |
working-directory: aseprite/build/bin | |
run: 7z -tzip a Aseprite-${{ needs.create-release.outputs.release-tag }}-${{ runner.os }}.zip * | |
- name: Upload release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: aseprite/build/bin/Aseprite-${{ needs.create-release.outputs.release-tag }}-${{ runner.os }}.zip | |
asset_name: Aseprite-${{ needs.create-release.outputs.release-tag }}-${{ runner.os }}.zip | |
tag: ${{ needs.create-release.outputs.release-tag }} |