This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
release v1.0.2 #14
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: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Build webpage | |
run: | | |
npm ci | |
npm run build | |
- name: Build server | |
run: | | |
cd server | |
npm ci | |
npm run build | |
cd .. | |
- name: Build Package | |
run: | | |
cd server | |
echo '{}' > test.json | |
zip res.zip test.json | |
npx pkg . -t node18-x64-windows | |
mkdir -p out/web | |
mkdir -p out/saves | |
cp config.json out/ | |
cp -r web/* out/web/ | |
cp -r res.zip out/saves/ | |
cd .. | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: MaaJsonViewer-win | |
path: '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 }} |