Skip to content

Commit

Permalink
added dev env and build action
Browse files Browse the repository at this point in the history
  • Loading branch information
Plagiatus committed Jun 18, 2024
1 parent eba6f39 commit 8874c5a
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 16 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build And Upload
on:
push:
branches: [ main ]
workflow_dispatch:

concurrency:
group: "build"
cancel-in-progress: true

jobs:
builds:
name: "Build 🔨"
runs-on: ubuntu-latest
steps:
- name: Get latest code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: "npm"
- name: Build Sveltekit
run: |
npm i
npm run build
- name: Upload to Server 📁
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.ftp_server }}
user: ${{ secrets.ftp_username }}
password: ${{ secrets.ftp_password }}
options: "--delete"
localDir: "build"
97 changes: 95 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.2",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
Expand All @@ -19,5 +20,8 @@
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
"type": "module",
"dependencies": {
"jszip": "^3.10.1"
}
}
6 changes: 2 additions & 4 deletions src/lib/comp/MainMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
let mobileVisible: boolean = false;
async function loadContributors(): Promise<void> {
let url = import.meta.env.DEV ? "/testData/contributors.json" : "https://api.github.com/repos/Gunivers/Bookshelf/contributors";
contributors = await (
await fetch(
// "https://api.github.com/repos/Gunivers/Bookshelf/contributors",
"/testData/contributors.json",
)
await fetch(url)
).json();
}
</script>
Expand Down
6 changes: 2 additions & 4 deletions src/lib/comp/ModuleSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
}
try {
let result = await fetch(
// `https://raw.githubusercontent.com/Gunivers/Bookshelf/${_selectedRelease.tag_name}/generated/manifest.json`,
`/testData/manifest.json`,
);
let url = import.meta.env.DEV ? `/testData/manifest.json` : `https://raw.githubusercontent.com/Gunivers/Bookshelf/${_selectedRelease.tag_name}/generated/manifest.json`;
let result = await fetch(url);
if (!result.ok) {
throw new Error(`${result.status} - ${result.statusText}`);
}
Expand Down
6 changes: 2 additions & 4 deletions src/lib/comp/VersionSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
async function loadReleases(): Promise<void> {
return new Promise(async (resolve, reject) => {
try {
let url = import.meta.env.DEV ? "/testData/releases.json" : "https://api.github.com/repos/Gunivers/Bookshelf/releases";
releases = await (
await fetch(
// "https://api.github.com/repos/Gunivers/Bookshelf/releases",
"/testData/releases.json"
)
await fetch(url)
).json();
if (releases.length <= 0) return;
selectedReleaseId = releases[0].id;
Expand Down
1 change: 1 addition & 0 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const prerender = true
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
Expand Down

0 comments on commit 8874c5a

Please sign in to comment.