Post

Automatically build Aseprite with Github Actions

Automatically fetch and compile Aseprite source code with Github Actions.

Automatically build Aseprite with Github Actions

Aseprite can be downloaded as freeware, (albeit it does not have the ability to save sprites) or purchased on Steam or Itch.io. Aseprite source code and binaries are distributed under EULA, educational, and Steam proprietary licenses.

The EULA permits others to download the Aseprite source code, compile it, and use it for personal purposes, but forbids its redistribution to third parties.

We can use Github Actions to automatically fetch Aseprite source code and compile it.

Github Actions

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that run tests whenever you push a change to your repository, or that deploy merged pull requests to production.

You can simply fork/clone my repository to setup the workflow:

1
$ git clone https://github.com/the0cp/aseprite-auto.git

Create workflow

In your repository on GitHub, create a workflow file *.yml in the .github/workflows directory. If your repository doesn’t have a .github/workflows directory, go to the main page of the repository on GitHub, click Add file, then click Create new file, and name the file .github/workflows/auto-build.yml (auto-build.yml, for example). This creates the .github and workflows directories and the auto-build.yml file in a single step.

YAML Code

Copy the following YAML contents into the auto-build.yml file:

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
name: Build and deploy Aseprite

on:
  schedule:
    - cron: '0 12 * * *'

env:
  BUILD_TYPE: Release
  ACTIONS_ALLOW_UNSECURE_COMMANDS: true

jobs:
  fetch-aseprite-info:
    name: Fetch deps info
    runs-on: ubuntu-latest
    outputs:
      download-link: $
      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
    runs-on: ubuntu-latest
    needs: fetch-aseprite-info
    permissions:
      contents: write
    outputs:
      download-link: $
      release-tag: $
    steps:
      - uses: actions/checkout@v2
      - uses: ncipollo/release-action@v1
        with:
          tag: $
          body: Aseprite-$
          skipIfReleaseExists: true
          token: $

  build-aseprite:
    name: Build Aseprite
    needs: create-release
    permissions:
      contents: write
    runs-on: $
    strategy:
        matrix:
          os: [ windows-latest, ubuntu-latest, macOS-latest ]
        fail-fast: false
    steps:
      - name: Install dependencies (Windows)
        if: matrix.os == 'windows-latest'
        uses: seanmiddleditch/gha-setup-ninja@master
      - name: Install dependencies (Ubuntu)
        if: matrix.os == 'ubuntu-latest'
        run: sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev
      - name: Install dependencies (macOS)
        if: matrix.os == 'macOS-latest'
        run: brew install ninja p7zip
      - name: Fetch Skia release link
        id: skia-link
        uses: a1393323447/fetch-release@main
        with:
            group: aseprite
            repo: skia
            match: Skia-$-Release-x64(-libstdc\+\+)?.zip
      - name: Download Skia
        run: |
          curl -o Skia-$-Release-x64.zip -L $
          unzip Skia-$-Release-x64.zip -d skia
      - name: Download Aseprite release
        run: |
          curl -o Aseprite-source.zip -L $
          unzip Aseprite-source.zip -d aseprite
          mkdir -p aseprite/build
      - name: Set architecture for the produced binary (Windows)
        if: matrix.os == 'windows-latest'
        uses: ilammy/msvc-dev-cmd@v1
      - name: Setting Visual Studio build environment variables and paths (Windows)
        if: matrix.os == 'windows-latest'
        uses: seanmiddleditch/gha-setup-vsdevenv@master
      - name: Run CMake (Windows)
        if: matrix.os == 'windows-latest'
        working-directory: aseprite/build
        shell: cmd
        run: cmake -DCMAKE_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: Run CMake (Ubuntu)
        if: matrix.os == 'ubuntu-latest'
        working-directory: aseprite/build
        run: cmake -DCMAKE_BUILD_TYPE=$ -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja ..
      - name: Run CMake (macOS)
        if: matrix.os == 'macOS-latest'
        working-directory: aseprite/build
        run: |
          cmake -DCMAKE_BUILD_TYPE=$ -DCMAKE_OSX_ARCHITECTURES=x86_64 -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-$-$.zip *
      - name: Upload release
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: $
          file: aseprite/build/bin/Aseprite-$-$.zip
          asset_name: Aseprite-$-$.zip
          tag: $

The code defaultly build Windows & Linux & OSX version of Aseprite and create a public release. Edit yourself.

Viewing workflow results

On GitHub, navigate to the main page of the repository. Under your repository name, click Actions.

The log shows you how each of the steps was processed. Expand any of the steps to view its details.

This post is licensed under CC BY 4.0 by the author.