Skip to content

Update action to work for Windows in 2022 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
59 changes: 37 additions & 22 deletions .github/workflows/aseprite_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Build and deploy Aseprite

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
- fix

env:
BUILD_TYPE: Release

jobs:
check-version:
name: Check latest Aseprite release
Expand All @@ -27,21 +29,23 @@ jobs:
LATEST_TAG=$(echo "${data}" | jq -r '.tag_name')
DOWNLOAD_URL=$(echo "${data}" | jq -r '.assets[].browser_download_url')
VERSION_INFO=$(echo "${data}" | jq -r '.body')

echo "${LATEST_TAG}" > ${LATEST_TAG}.txt
echo "::set-output name=latest_tag::${LATEST_TAG}"
echo "::set-output name=download_url::${DOWNLOAD_URL}"
echo "::set-output name=version_info::${VERSION_INFO}"
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
echo "download_url=${DOWNLOAD_URL}" >> $GITHUB_OUTPUT
echo "version_info<<EOF" >> $GITHUB_OUTPUT
echo "$VERSION_INFO" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Load version from cache
id: version_check
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.version_info.outputs.latest_tag }}.txt
key: cached_version
- name: Should we start new build?
id: should_build
if: steps.version_check.outputs.cache-hit != 'true'
run: echo "::set-output name=should_build::true"
if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/fix' || steps.version_check.outputs.cache-hit != 'true'
run: echo "should_build=true" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
if: steps.should_build.outputs.should_build
Expand All @@ -55,7 +59,7 @@ jobs:
${{ steps.version_info.outputs.version_info }}
draft: true
prerelease: false

build-aseprite:
name: Build Aseprite
needs: check-version
Expand All @@ -64,27 +68,38 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
fail-fast: false
fail-fast: false
steps:
- name: (Windows) Install dependencies
if: matrix.os == 'windows-latest'
uses: seanmiddleditch/gha-setup-ninja@v1
uses: seanmiddleditch/gha-setup-ninja@v3
- name: (Windows) Remove OpenSLL from PATH
if: matrix.os == 'windows-latest'
shell: powershell
run: Remove-Item -Recurse -Force "C:\Program Files\OpenSSL\"
- name: (Ubuntu) Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt install -y cmake ninja-build libxcursor-dev libxi-dev libgl1-mesa-dev
run: sudo apt update && sudo apt install -y cmake ninja-build libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig-dev
- name: (macOS) Install dependencies
if: matrix.os == 'macOS-latest'
run: brew install ninja p7zip
- name: Get Skia from cache
id: skia-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: skia
key: skia-${{ matrix.os }}-cache
- name: Download Skia if not in cache (linux)
if: steps.skia-cache.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest'
# curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-${{ runner.os }}-Release-x64-libstdc++.zip
run: |
curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-${{ runner.os }}-Release-x64.zip
unzip Skia-${{ runner.os }}-Release-X64.zip -d skia
- name: Download Skia if not in cache
if: steps.skia-cache.outputs.cache-hit != 'true'
if: steps.skia-cache.outputs.cache-hit != 'true' && matrix.os != 'ubuntu-latest'
# curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-${{ runner.os }}-Release-x64.zip
run: |
curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m81-b607b32047/Skia-${{ runner.os }}-Release-X64.zip
curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m124-08a5439a6b/Skia-${{ runner.os }}-Release-x64.zip
unzip Skia-${{ runner.os }}-Release-X64.zip -d skia
- name: Download Aseprite release
run: |
Expand All @@ -94,23 +109,23 @@ jobs:
- name: (Windows) Set architecture for the produced binary
if: matrix.os == 'windows-latest'
shell: cmd
run: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
run: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
- name: (Windows) Setting Visual Studio build environment variables and paths
if: matrix.os == 'windows-latest'
uses: seanmiddleditch/gha-setup-vsdevenv@v1
uses: seanmiddleditch/gha-setup-vsdevenv@v4
- name: (Windows) Run CMake
if: matrix.os == 'windows-latest'
working-directory: aseprite/build
shell: cmd
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_IGNORE_PATH='C:/ProgramData/chocolatey/bin/;C:/Strawberry/c/bin/' -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja ..
shell: pwsh
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_IGNORE_PATH='C:/ProgramData/chocolatey/bin/;C:/Strawberry/c/bin/' -DLAF_BACKEND=skia -DSKIA_DIR="$(Convert-Path ../../skia)" -DSKIA_LIBRARY_DIR="$(Convert-Path ../../skia/out/Release-x64)" -DSKIA_LIBRARY="$(Convert-Path ../../skia/out/Release-x64/skia.lib)" -G Ninja ..
- name: (Ubuntu) Run CMake
if: matrix.os == 'ubuntu-latest'
working-directory: aseprite/build
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja ..
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DLAF_BACKEND=skia -DSKIA_DIR=$(realpath ../../skia) -DSKIA_LIBRARY_DIR=$(realpath ../../skia/out/Release-x64) -G Ninja ..
- name: (macOS) Run CMake
if: matrix.os == 'macOS-latest'
working-directory: aseprite/build
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja ..
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DLAF_BACKEND=skia -DSKIA_DIR=$(realpath ../../skia) -DSKIA_LIBRARY_DIR=$(realpath ../../skia/out/Release-x64) -G Ninja ..
- name: Run Ninja
working-directory: aseprite/build
run: ninja aseprite
Expand All @@ -132,4 +147,4 @@ jobs:
upload_url: ${{ needs.check-version.outputs.upload_url }}
asset_path: aseprite/build/bin/Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip
asset_name: Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip
asset_content_type: application/zip
asset_content_type: application/zip