This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
feat: simple draw #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- main # Set a branch name to trigger deployment | |
pull_request: | |
jobs: | |
meta: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.set_tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set_tag | |
run: | | |
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT | |
build: | |
needs: meta | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Setup emsdk | |
uses: mymindstorm/setup-emsdk@v11 | |
- name: Install cmake | |
run: | | |
sudo apt-get update | |
sudo apt-get install cmake | |
- name: Build wasm module | |
run: | | |
cd render | |
mkdir build | |
cd build | |
emcmake cmake .. | |
cmake --build . | |
mkdir Release | |
cp render.js render.wasm Release/ | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Build | |
run: | | |
npm ci | |
npm run build | |
- name: Prepare MaaFramework | |
run: | | |
cd packages/server | |
wget https://github.com/MaaAssistantArknights/MaaFramework/releases/download/v0.3.5/MAA-win-x86_64-v0.3.5.zip -O maa.zip | |
mkdir maaframework | |
cd maaframework | |
unzip ../maa.zip | |
rm -r docs | |
rm -r include | |
rm -r lib | |
mv share/MaaAgentBinary . | |
rm -r share | |
cd ../../.. | |
- name: Prepare Model | |
run: | | |
cd packages/server | |
mkdir -p maaframework/model | |
wget https://github.com/MaaAssistantArknights/MAA1999/releases/download/v0.3.2/MAA1999-win-x64-v0.3.2.zip -O maa1999.zip | |
mkdir 1999 | |
cd 1999 | |
unzip ../maa1999.zip | |
cd .. | |
cp -r ./1999/resource/model/* maaframework/model/ | |
cd ../.. | |
- name: Build Package | |
run: | | |
cd packages/server | |
echo '{}' > test.json | |
zip res.zip test.json | |
npx pkg . -t node18-x64-windows | |
mkdir -p out/library | |
mkdir -p out/saves | |
mkdir -p out/web | |
cp assets/config.json out/ | |
mv maaframework out/library/ | |
cp assets/controller_config.json out/library/maaframework/ | |
cp -r web/* out/web/ | |
cp -r res.zip out/saves/ | |
cd ../.. | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: MaaJsonViewer-win | |
path: 'packages/server/out' | |
- name: Clean for env | |
run: | | |
cd packages/server | |
rm -r out/library/maaframework/bin | |
rm -r out/web | |
rm out/server.exe | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: MaaJsonViewer-env | |
path: 'packages/server/out' | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [meta, build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: assets | |
- run: | | |
cd assets | |
for f in *; do | |
(cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .) | |
done | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: assets/*.zip | |
tag_name: ${{ needs.meta.outputs.tag }} |