diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 474a6e4..c686b3e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,6 +10,11 @@ "packages": "pnpm", "upgradePackages": true } + }, + "customizations": { + "vscode": { + "extensions": ["esbenp.prettier-vscode"] + } } // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 0a22070..dc7569c 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -63,4 +63,34 @@ jobs: git add . git commit -m "chore: release [ci skip]" git push - fi \ No newline at end of file + fi + + build-and-push: + # if: gitea.ref == 'refs/heads/main' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.demonkernel.io.vn + username: ${{ github.actor }} + password: ${{ secrets.ACCESS_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: gitea.demonkernel.io.vn/${{ gitea.repository }}:latest + + deploy-via-portainer: + if: gitea.ref == 'refs/heads/main' + needs: build-and-push + runs-on: ubuntu-latest + steps: + - name: Trigger Portainer Webhook + run: | + curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}" \ No newline at end of file diff --git a/.gitignore b/.gitignore index d3d7359..8bdfd8e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ # production /build +/release.zip # misc .DS_Store diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..2bb59b5 --- /dev/null +++ b/dockerfile @@ -0,0 +1,5 @@ +FROM nginx:alpine + +COPY out/ /usr/share/nginx/html/ + +EXPOSE 80 \ No newline at end of file diff --git a/next.config.ts b/next.config.ts index 75c87ca..f81aba1 100644 --- a/next.config.ts +++ b/next.config.ts @@ -9,6 +9,11 @@ import type { NextConfig } from "next"; * * Docs: https://nextjs.org/docs/app/api-reference/next-config-js */ -const nextConfig: NextConfig = {}; +const nextConfig: NextConfig = { + output: "export", // Bắt buộc để tạo ra thư mục /out + images: { + unoptimized: true, // Thường cần thiết cho static export + }, +}; export default nextConfig; diff --git a/release.config.ts b/release.config.ts index 5736540..18b2898 100644 --- a/release.config.ts +++ b/release.config.ts @@ -16,12 +16,13 @@ const config: GlobalConfig = { }, ], [ - "@semantic-release/github", + "@saithodev/semantic-release-gitea", { + giteaUrl: "https://git.demonkernel.io.vn/", assets: [ { path: "release.zip", - name: "TDTU Auto Login v${nextRelease.version}.zip", + name: "Drinkool v${nextRelease.version}.zip", }, ], }, diff --git a/scripts/release.ts b/scripts/release.ts new file mode 100644 index 0000000..73e908c --- /dev/null +++ b/scripts/release.ts @@ -0,0 +1,19 @@ +import { execSync } from "node:child_process"; + +const version = process.argv[2]; +if (!version) { + console.error("❌ Version không được cung cấp!"); + process.exit(1); +} + +const zipPath = "release.zip"; + +console.log(`📦 Đang nén file cho version: ${version}...`); + +execSync(`zip -r ${zipPath} out`, { + stdio: "inherit", +}); + +console.log(`✅ Đã tạo file zip: ${zipPath}`); + +execSync("pnpm format");