Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

ci: fix

ci: fix #4

Workflow file for this run

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
npx pkg . -t node18-x64-windows
mkdir -p out/web
cp -r web/* out/web/
mkdir -p 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 }}