Skip to content

Commit

Permalink
Migrate from retro (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
chehsunliu authored Oct 24, 2024
1 parent bf261c6 commit fbcca77
Show file tree
Hide file tree
Showing 116 changed files with 12,021 additions and 14,553 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Stop the editor from looking for .editorconfig files in the parent directories
# root = true

[*]

# Non-configurable Prettier behaviors
charset = utf-8
insert_final_newline = true

# Configurable Prettier behaviors
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 120
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
categories:
- title: 仙劍奇俠傳
labels:
- "Component: PAL"

- title: 新仙劍奇俠傳
labels:
- "Component: PAL-New"

- title: 軒轅劍外傳 - 楓之舞
labels:
- "Component: SWD-2E"

- title: Other Changes
labels:
- "*"
52 changes: 25 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
name: Build
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
build-and-test:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 14.x
node-version: 20

- id: yarn-cache-dir-path
name: Get yarn cache directory path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Install dependencies
run: npm install

- id: yarn-cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Check the code format
run: npm run fmt-check

- name: Show yarn version
run: yarn --version

- name: Install dependencies
run: yarn install
- name: Check ESLint
run: npm run lint

- name: Build
run: yarn build
run: npm run build

- name: Run linter
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Run tests
run: yarn test --coverage
- name: Install dependencies
run: npm install

- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
- name: Run the tests
run: npm run test -- --coverage
115 changes: 115 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Deploy

on:
release:
types: [published]
workflow_dispatch:
inputs:
overwrite-production:
type: boolean
required: false
description: Overwrite the root folder

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Select ref
id: ref-selector
run: |
if [[ '${{ inputs.overwrite-production }}' == "true" ]]; then
echo 'ref=${{ github.sha }}' >> "$GITHUB_OUTPUT"
exit 0
fi
ref=$(gh release list --json name --exclude-drafts --exclude-pre-releases --limit 1 | jq -r '.[].name')
if [[ -z "$ref" ]]; then
echo "ref=main" >> "$GITHUB_OUTPUT"
else
echo "ref=$ref" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4
with:
ref: ${{ steps.ref-selector.outputs.ref }}

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: npm run build -- --base=/pal-save-editor/
env:
VITE_RETRO_VERSION: ${{ steps.ref-selector.outputs.ref }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: ./dist

build-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: |
sha=${{ github.sha }}
export VITE_RETRO_VERSION=${sha::7}
npm run build -- --base=/pal-save-editor/preview/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-preview
path: ./dist

merge-builds:
needs: [build, build-preview]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: ./dist

- uses: actions/download-artifact@v4
with:
name: build-preview
path: ./dist/preview

- name: Debug
run: tree .

- name: Upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: "dist"

deploy:
needs: merge-builds
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
76 changes: 0 additions & 76 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit fbcca77

Please sign in to comment.