Compare commits
17 commits
Author | SHA1 | Date | |
---|---|---|---|
025ff6a42f | |||
a54baf4b3d | |||
677b762a71 | |||
a5e6c6fa3b | |||
8fda8a7309 | |||
197b10cccf | |||
46c5b39d6b | |||
929df2f3bb | |||
4bc9ef0804 | |||
9d7109d66c | |||
|
4117477283 | ||
|
12c7ef2a8e | ||
|
8a2e88e302 | ||
|
9406dbdc5d | ||
|
098a4cad1d | ||
|
aaad32a51d | ||
|
ac25eb3708 |
9 changed files with 152 additions and 78 deletions
95
.forgejo/workflows/build+release.yml
Normal file
95
.forgejo/workflows/build+release.yml
Normal file
|
@ -0,0 +1,95 @@
|
|||
name: 'Build and Release Docker Image'
|
||||
author: 'Neshura'
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9]+.[0-9]+.[0-9]+'
|
||||
- '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
-
|
||||
name: Checking Out Repository Code
|
||||
uses: https://code.forgejo.org/actions/checkout@v3
|
||||
-
|
||||
name: Get Yarn Cache Directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
-
|
||||
name: Set Up Yarn Cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
-
|
||||
name: Install Dependencies
|
||||
run: yarn install
|
||||
-
|
||||
name: Run Linter
|
||||
run: yarn lint
|
||||
-
|
||||
name: Check if Version in package.json matches Tag
|
||||
run: |
|
||||
VERSION=$(cat package.json | grep "version" | sed 's/.*://' | tr -d , | tr -d \" | tr -d " " )
|
||||
if test $VERSION != "${{ github.ref_name }}"; then
|
||||
echo "Expected Version is: '${{ github.ref_name }}' actual Version is: '$VERSION'";
|
||||
exit 1
|
||||
else
|
||||
echo "Version is: '$VERSION'";
|
||||
fi
|
||||
|
||||
build:
|
||||
needs: test
|
||||
if: success()
|
||||
runs-on: dind
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
config-inline: |
|
||||
[registry."docker.io"]
|
||||
mirrors = ["https://docker-cache.neshweb.net"]
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: forgejo.neshweb.net
|
||||
username: ${{ secrets.FORGEJO_USERNAME }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
-
|
||||
name: Determine Docker tags
|
||||
id: tags
|
||||
run: |
|
||||
if echo ${{ github.ref_name }} | grep -qi '\-rc' ; then
|
||||
echo latest=forgejo.neshweb.net/neshweb-sites/${{ github.event.repository.name }}:preview >> $GITHUB_OUTPUT;
|
||||
else
|
||||
echo latest=forgejo.neshweb.net/neshweb-sites/${{ github.event.repository.name }}:latest >> $GITHUB_OUTPUT;
|
||||
fi
|
||||
echo version=forgejo.neshweb.net/neshweb-sites/${{ github.event.repository.name }}:${{ github.ref_name }} >> $GITHUB_OUTPUT;
|
||||
-
|
||||
name: Push to Package Registry
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ steps.tags.outputs.version }}, ${{ steps.tags.outputs.latest }}
|
||||
|
||||
release:
|
||||
needs: build
|
||||
if: success()
|
||||
runs-on: docker
|
||||
steps:
|
||||
-
|
||||
name: Release New Version
|
||||
uses: actions/forgejo-release@v1
|
||||
with:
|
||||
direction: upload
|
||||
url: https://forgejo.neshweb.net
|
||||
release-dir: release
|
||||
token: ${{ secrets.FORGEJO_TOKEN }}
|
||||
tag: ${{ github.ref_name }}
|
35
.forgejo/workflows/test.yml
Normal file
35
.forgejo/workflows/test.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: 'Run Tests on Code'
|
||||
author: 'Neshura'
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
branches:
|
||||
- '**'
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
-
|
||||
name: Checking Out Repository Code
|
||||
uses: https://code.forgejo.org/actions/checkout@v3
|
||||
-
|
||||
name: Get Yarn Cache Directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
-
|
||||
name: Set Up Yarn Cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
-
|
||||
name: Install Dependencies
|
||||
run: yarn install
|
||||
-
|
||||
name: Run Linter
|
||||
run: yarn lint
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -17,3 +17,5 @@ yarn-error.log*
|
|||
build/
|
||||
data/
|
||||
confs/
|
||||
|
||||
.idea/
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
stages:
|
||||
- lint
|
||||
#- test
|
||||
- build
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
IMAGE_LATEST: $CI_REGISTRY_IMAGE:develop
|
||||
|
||||
|
||||
.node:
|
||||
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:latest
|
||||
|
||||
|
||||
.docker:
|
||||
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:20
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /(^t)+.*/
|
||||
variables:
|
||||
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
||||
|
||||
linter:
|
||||
image: !reference [.node, image]
|
||||
stage: lint
|
||||
before_script:
|
||||
- yarn install
|
||||
script:
|
||||
- yarn lint
|
||||
|
||||
|
||||
build:
|
||||
image: !reference [.docker, image]
|
||||
stage: build
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- docker build -t $IMAGE_TAG .
|
||||
after_script:
|
||||
- docker save $IMAGE_TAG > docker.tar
|
||||
artifacts:
|
||||
expire_in: 30 mins
|
||||
paths:
|
||||
- docker.tar
|
||||
rules:
|
||||
- !reference [.docker, rules]
|
||||
|
||||
|
||||
push:
|
||||
image: !reference [.docker, image]
|
||||
stage: deploy
|
||||
needs:
|
||||
- job: build
|
||||
artifacts: true
|
||||
before_script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker load -i docker.tar
|
||||
script:
|
||||
- docker tag $IMAGE_TAG $IMAGE_LATEST
|
||||
- docker push $IMAGE_TAG
|
||||
- docker push $IMAGE_LATEST
|
||||
rules:
|
||||
- !reference [.docker, rules]
|
11
Dockerfile
11
Dockerfile
|
@ -1,17 +1,18 @@
|
|||
## INIT STEP
|
||||
# Install dependencies only when needed
|
||||
FROM node:16-alpine AS deps
|
||||
FROM node:18-alpine AS deps
|
||||
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the files needed to install deps
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn add sharp
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
## BUILD STEP
|
||||
# Rebuild the source code only when needed
|
||||
FROM node:16-alpine AS builder
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
@ -23,10 +24,10 @@ COPY . .
|
|||
RUN yarn build
|
||||
|
||||
## RUN STEP
|
||||
FROM node:16-alpine AS runner
|
||||
FROM node:18-alpine AS runner
|
||||
|
||||
LABEL author="neshura@proton.me"
|
||||
WORKDIR /usr/src/ap
|
||||
LABEL author="neshura@neshweb.net"
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ const LayoutReadyOrNot = ({ children }: { children: React.ReactNode }) => {
|
|||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
|
||||
_paq.push(["setCookieDomain", "readyornot.neshura-server.net"]);
|
||||
_paq.push(["setCookieDomain", "readyornot.neshweb.net"]);
|
||||
_paq.push(["disableCookies"]);
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="//temp.neshura-server.net/";
|
||||
var u="//tracking.neshweb.net/";
|
||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||
_paq.push(['setSiteId', '2']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
|
|
11
package.json
11
package.json
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "readyornot",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.8",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev:debug": "NODE_OPTIONS='--inspect' next dev -p 4042",
|
||||
"dev": "next dev",
|
||||
"dev:debug": "NODE_OPTIONS='--inspect' next dev -H :: -p 8002",
|
||||
"dev": "next dev -H :: -p 8002",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"start": "next start -H :: -p 8002",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -17,9 +17,10 @@
|
|||
"swr": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.14.6",
|
||||
"@types/react": "^18.0.14",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"@types/react": "^18.0.14",
|
||||
"typescript": "4.9.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import fsPromises from 'fs/promises'
|
|||
import path from 'path'
|
||||
import ReadyOrNotMap from '../../interfaces/ReadyOrNot'
|
||||
|
||||
export default async function TobarApi(req: any, res: any) {
|
||||
export default async function SidebarAPI(req: any, res: any) {
|
||||
try {
|
||||
// get list of all folders(maps) in the readyornot folder - maybe there is a cleaner way to do this?
|
||||
var fs = require('fs')
|
||||
|
|
|
@ -166,6 +166,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
|
||||
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
|
||||
|
||||
"@types/node@18.14.6":
|
||||
version "18.14.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.6.tgz#ae1973dd2b1eeb1825695bb11ebfb746d27e3e93"
|
||||
integrity sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==
|
||||
|
||||
"@types/prop-types@*":
|
||||
version "15.7.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
|
||||
|
|
Reference in a new issue