add workflow
This commit is contained in:
84
.gitea/workflows/release.yaml
Normal file
84
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Release Build
|
||||
run-name: Build and Release by ${{ gitea.actor }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Push Server
|
||||
run: |
|
||||
cd zen_kanji_js/server
|
||||
docker build -t ${{ vars.REGISTRY }}/zen-kanji-server:latest .
|
||||
docker push ${{ vars.REGISTRY }}/zen-kanji-server:latest
|
||||
|
||||
- name: Build and Push Client
|
||||
run: |
|
||||
cd zen_kanji_js/client
|
||||
docker build -t ${{ vars.REGISTRY }}/zen-kanji-client:latest .
|
||||
docker push ${{ vars.REGISTRY }}/zen-kanji-client:latest
|
||||
|
||||
build-android-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: "17"
|
||||
distribution: "temurin"
|
||||
|
||||
- name: Install and Build Web App
|
||||
working-directory: zen_kanji_js/client
|
||||
env:
|
||||
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
||||
run: |
|
||||
npm ci
|
||||
npm run build:android
|
||||
|
||||
- name: Sync Capacitor to Android
|
||||
working-directory: zen_kanji_js/client
|
||||
run: npx cap sync android
|
||||
|
||||
- name: Decode Keystore
|
||||
run: |
|
||||
cd zen_kanji_js/client/android/app
|
||||
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > my-release-key.jks
|
||||
|
||||
- name: Build Release APK
|
||||
working-directory: zen_kanji_js/client/android
|
||||
env:
|
||||
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
|
||||
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew assembleRelease
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/release-action@v1
|
||||
with:
|
||||
tag_name: v1.0.${{ gitea.run_number }}
|
||||
name: Release v1.0.${{ gitea.run_number }}
|
||||
body: |
|
||||
Automated release for commit ${{ gitea.sha }}.
|
||||
|
||||
**Docker Images:**
|
||||
- Server: `${{ vars.REGISTRY }}/${{ vars.SERVER_IMAGE }}:latest`
|
||||
- Client: `${{ vars.REGISTRY }}/${{ vars.CLIENT_IMAGE }}:latest`
|
||||
files: |
|
||||
zen_kanji_js/client/android/app/build/outputs/apk/release/*.apk
|
||||
api_key: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,2 +0,0 @@
|
||||
CAP_ENV=dev
|
||||
VITE_API_URL=https://zenkanji-api.crylia.de
|
||||
@@ -15,13 +15,13 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
allowedHosts: [
|
||||
'zenkanji.crylia.de',
|
||||
import.meta.env.VITE_HOST,
|
||||
],
|
||||
host: true,
|
||||
port: 5173,
|
||||
strictPort: true,
|
||||
hmr: {
|
||||
host: 'zenkanji.crylia.de',
|
||||
host: import.meta.env.VITE_HOST,
|
||||
protocol: 'wss',
|
||||
clientPort: 443,
|
||||
},
|
||||
|
||||
@@ -11,21 +11,10 @@ const fastify = Fastify({ logger: true });
|
||||
await connectDB();
|
||||
|
||||
const allowedOrigins = [
|
||||
'http://192.168.0.26:5169',
|
||||
'http://192.168.0.26:5173',
|
||||
'http://localhost:5173',
|
||||
'http://localhost',
|
||||
'https://localhost',
|
||||
'capacitor://localhost',
|
||||
'https://10.0.2.2:5173',
|
||||
'https://zenkanji.crylia.de'
|
||||
process.env.SERVER_EXT_ACCESS,
|
||||
process.env.SERVER_INT_ACCESS
|
||||
];
|
||||
|
||||
if (process.env.CORS_ORIGINS) {
|
||||
const prodOrigins = process.env.CORS_ORIGINS.split(',');
|
||||
allowedOrigins.push(...prodOrigins);
|
||||
}
|
||||
|
||||
await fastify.register(cors, {
|
||||
origin: allowedOrigins,
|
||||
methods: ['GET', 'POST', 'PUT', 'DELETE'],
|
||||
@@ -67,7 +56,6 @@ await fastify.register(routes);
|
||||
const start = async () => {
|
||||
try {
|
||||
await fastify.listen({ port: PORT, host: '0.0.0.0' });
|
||||
console.log(`Server running at http://localhost:${PORT}`);
|
||||
} catch (err) {
|
||||
fastify.log.error(err);
|
||||
process.exit(1);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export const PORT = process.env.PORT || 3000;
|
||||
export const MONGO_URI = process.env.MONGO_URI || 'mongodb://mongo:27017/zenkanji' || 'mongodb://192.168.0.26:27017/zenkanji';
|
||||
export const SRS_TIMINGS_HOURS = [0, 2, 4, 8, 23, 47];
|
||||
export const PORT = 3000;
|
||||
export const MONGO_URI = process.env.MONGO_URI
|
||||
export const JWT_SECRET = process.env.JWT_SECRET;
|
||||
|
||||
Reference in New Issue
Block a user