Skip to content

fix: use proper syntax for sending multiline strings to GitHub Action… #14

fix: use proper syntax for sending multiline strings to GitHub Action…

fix: use proper syntax for sending multiline strings to GitHub Action… #14

Workflow file for this run

name: Build Aseprite
on:
push:
branches:
- main
schedule:
- cron: '0 0 30 6,12 *'
env:
BUILD_TYPE: RelWithDebInfo
CC: clang
CXX: clang++
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}"
delimiter="$(openssl rand -hex 8)"
echo "version_info<<${delimiter}
echo "${VERSION_INFO}" >> "${GITHUB_OUTPUT}"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
- name: Load version from cache
id: version_check
uses: actions/cache@v2
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 "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-linux:
name: Build for Linux
needs: check-version
if: ${{ needs.check-version.outputs.should_build }}
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt install -y g++ clang libc++-dev libc++abi-dev cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev unzip p7zip
- name: Download Skia for Aseprite
run: |
curl -LO $(curl -s https://api.github.com/repos/aseprite/skia/releases/latest | grep "tag_name" | awk '{print "https://github.com/aseprite/skia/releases/download/" substr($2, 2, length($2)-3) "/Skia-${{ runner.os }}-Release-x64-libc++.zip"}')
unzip -q "Skia-${{ runner.os }}-Release-x64-libc++.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: Run CMake
working-directory: aseprite/build
run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS:STRING=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS:STRING=-stdlib=libc++ -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -DSKIA_LIBRARY=../../skia/out/Release-x64/libskia.a -G Ninja ..
- name: Run Ninja
working-directory: aseprite/build
run: ninja aseprite
- name: Clean up build
working-directory: aseprite/build/bin
run: rm -f gen modp_b64_gen
- name: Create release asset
working-directory: aseprite/build/bin
run: 7z -tzip a Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip *
- name: Upload release asset
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