Skip to content

Automatic check update and Build #74

Automatic check update and Build

Automatic check update and Build #74

Workflow file for this run

name: Automatic check update and Build
on:
# # Uncomment it to make this workflow automatic
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
outputs:
match: ${{ steps.check-tags.outputs.match }}
tag: ${{ steps.target-tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
- name: Get latest tags
id: target-tag
run: |
tag=$(curl -s https://api.github.com/repos/aseprite/aseprite/tags | jq -r '.[0].name')
# echo "::set-output name=tag::$tag"
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
- name: Get local tags
id: current-tag
run: |
tag=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }} " -s https://api.github.com/repos/${{ github.repository }}/tags | jq -r '.[0].name')
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
- name: Comparing tags
id: check-tags
run: |
if [ "${{ steps.target-tag.outputs.tag }}" == "${{ steps.current-tag.outputs.tag }}" ] ; then
echo "Tags match, skipping downstream job"
echo "match=false" >> $GITHUB_OUTPUT
else
echo "Tags do not match, running downstream job"
echo "match=true" >> $GITHUB_OUTPUT
fi
- name: Set build
run: |
echo ${{ steps.check-tags.outputs.match }}
build:
needs: check
if: needs.check.outputs.match == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
build_type: [Release]
enable_ui: [on]
include:
- os: windows-latest
build_type: Release
enable_ui: on
steps:
- name: Get releases body
id: get-content
shell: bash
run: |
body=$(curl -s https://api.github.com/repos/aseprite/aseprite/releases/tags/${{ needs.check.outputs.tag }} | jq -r '.body')
echo "body-content=$(echo $body)" >> $GITHUB_OUTPUT
echo $body
GITHUB_REPOSITORY="${{ github.repository }}"
REPO_NAME="${GITHUB_REPOSITORY#${{ github.repository_owner }}/}"
echo "repo-name=$(echo $REPO_NAME)" >> $GITHUB_OUTPUT
echo $REPO_NAME
- uses: actions/checkout@v3
with:
repository: 'aseprite/aseprite'
submodules: 'recursive'
ref: ${{ needs.check.outputs.tag }}
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: ilammy/msvc-dev-cmd@v1
- name: Get skia and generate Makefile
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]] ; then
export enable_ccache=off
else
export enable_ccache=on
fi
curl -L -o skia.zip https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-Windows-Release-x64.zip
7z x skia.zip -oskia
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DENABLE_UI=${{ matrix.enable_ui }} \
-DENABLE_CCACHE=$enable_ccache \
-DLAF_BACKEND=skia \
-DSKIA_DIR=./skia \
-DSKIA_LIBRARY_DIR=./skia/out/Release-x64 \
-DSKIA_LIBRARY=./skia/out/Release-x64/skia.lib
- name: Compile
shell: bash
run: |
cd build && ninja
- name: Get "libcrypto-1_1-x64.dll"
shell: bash
run: |
GITHUB_REPOSITORY="${{ github.repository }}"
REPO_NAME="${GITHUB_REPOSITORY#${{ github.repository_owner }}/}"
curl -L -o D:/a/$REPO_NAME/$REPO_NAME/build/bin/libcrypto-1_1-x64.dll https://github.com/feenkcom/libopenssl/releases/download/v0.5.0/crypto-x86_64-pc-windows-msvc.dll
# # 为了遵守 Aseprite 的 EULA, 请确保仓库为私有再启用该功能
# - name: 上传文件到 artifact
# uses: actions/upload-artifact@v3
# with:
# name: aseprite
# path: |
# REPO_NAME=${{ steps.get-content.outputs.repo-name }}
# D:/a/$REPO_NAME/$REPO_NAME/build/bin/data
# D:/a/$REPO_NAME/$REPO_NAME/build/bin/aseprite.exe
# D:/a/$REPO_NAME/$REPO_NAME/build/bin/libcrypto-1_1-x64.dll
- name: Zip
shell: bash
run: |
GITHUB_REPOSITORY="${{ github.repository }}"
REPO_NAME="${GITHUB_REPOSITORY#${{ github.repository_owner }}/}"
cd D:/a/$REPO_NAME/$REPO_NAME/build/bin/
7z a -tzip aseprite.${{ needs.check.outputs.tag }}.zip data aseprite.exe libcrypto-1_1-x64.dll
cp aseprite.${{ needs.check.outputs.tag }}.zip D:/a/
- name: Upload releases
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.check.outputs.tag }}
name: Aseprite ${{ needs.check.outputs.tag }}
body: ${{ steps.get-content.outputs.body-content }}
draft: true # 为了遵守 Aseprite 的 EULA, 取消 draft 前请确保仓库为私有
prerelease: false
files: |
D:/a/aseprite.${{ needs.check.outputs.tag }}.zip