forked from pedroterzero/aseprite_builder
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (139 loc) · 6.52 KB
/
aseprite_build_deploy.yml
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
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
runs-on: ubuntu-latest
outputs:
download_url: ${{ steps.version_info.outputs.download_url }}
latest_tag: ${{ steps.version_info.outputs.latest_tag }}
should_build: ${{ steps.should_build.outputs.should_build }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get latest version info
id: version_info
run: |
data=$(curl -sL https://api.github.com/repos/aseprite/aseprite/releases/latest)
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 "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@v3
with:
path: ${{ steps.version_info.outputs.latest_tag }}.txt
key: cached_version
- name: Should we start new build?
id: should_build
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
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_info.outputs.latest_tag }}
release_name: Release Aseprite ${{ steps.version_info.outputs.latest_tag }}
body: |
${{ steps.version_info.outputs.version_info }}
draft: true
prerelease: false
build-aseprite:
name: Build Aseprite
needs: check-version
if: ${{ needs.check-version.outputs.should_build }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
fail-fast: false
steps:
- name: (Windows) Install dependencies
if: matrix.os == 'windows-latest'
uses: seanmiddleditch/gha-setup-ninja@v3
- name: (Ubuntu) Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install -y cmake ninja-build libxcursor-dev libxi-dev libgl1-mesa-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@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'
run: |
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
unzip Skia-${{ runner.os }}-Release-X64.zip -d skia
- name: Download Skia if not in cache
if: steps.skia-cache.outputs.cache-hit != 'true' && matrix.os != 'ubuntu-latest'
run: |
curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-${{ runner.os }}-Release-x64.zip
unzip Skia-${{ runner.os }}-Release-X64.zip -d skia
- name: Download Aseprite release
run: |
curl -o Aseprite-source.zip -L ${{ needs.check-version.outputs.download_url }}
unzip Aseprite-source.zip -d aseprite
mkdir -p aseprite/build
- name: (Windows) Set architecture for the produced binary
if: matrix.os == 'windows-latest'
shell: cmd
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@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 ..
- 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 ..
- 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/MacOSX.sdk -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja ..
- name: Run Ninja
working-directory: aseprite/build
run: ninja aseprite
- name: Clean up build
working-directory: aseprite/build/bin
shell: bash
run: rm -f gen modp_b64_gen gen.exe gen.exe.manifest modp_b64_gen.exe modp_b64_gen.exe.manifest
- name: (Windows) Make portable zip
working-directory: aseprite/build/bin
run: echo '# This file is here so Aseprite behaves as a portable program' > aseprite.ini
- name: Create release
working-directory: aseprite/build/bin
run: 7z -tzip a Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip *
- name: Upload release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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