diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65c52bf1..c278fb45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,12 +3,6 @@ name: Build Docker on: pull_request: push: - tags: - - '\d+\.\d+\.\d+' - - '\d+\.\d+' - - '\d+\.\d+\.\d+-beta\d+' - - '\d+\.\d+-beta\d+' - - '\d+\.\d+-alpha\d+' jobs: test: @@ -31,6 +25,9 @@ jobs: pytest build-webui: + if: > + (github.event_name == 'pull_request') || + (github.event_name == 'push' && github.ref_type == 'tag' && (contains(github.ref, 'alpha') || contains(github.ref, 'beta'))) runs-on: ubuntu-latest needs: [test] steps: @@ -63,7 +60,7 @@ jobs: build-docker: runs-on: ubuntu-latest - needs: [test, build-webui] + needs: [build-webui] steps: - name: Checkout uses: actions/checkout@v3 @@ -146,10 +143,10 @@ jobs: cache-to: type=gha, scope=${{ github.workflow }} release: - runs-on: ubuntu-latest if: > - ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }} - || ${{ github.event_name == 'push' && contains(github.ref, 'tags') }} + (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || + (github.event_name == 'push' && contains(github.ref, 'tags')) + runs-on: ubuntu-latest needs: [ build-docker ] steps: @@ -201,4 +198,4 @@ jobs: token: ${{ secrets.TELEGRAM_TOKEN }} message: | New release: ${{ github.event.release.title }} - Link: ${{ github.event.release.html_url }} \ No newline at end of file + Link: ${{ github.event.release.html_url }} diff --git a/Dockerfile b/Dockerfile index 9e0f62d7..c2e996b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,14 +36,16 @@ RUN apk add --no-cache \ sed -i '/bcrypt/d' requirements.txt && \ pip install --no-cache-dir -r requirements.txt && \ # Unzip WebUI \ - unzip dist.zip -d /app/templates && \ + unzip dist.zip && \ + mv dist templates && \ # Add user addgroup -S ab -g 911 && \ adduser -S ab -G ab -h /ab -s /bin/bash -u 911 && \ # Clear rm -rf \ /root/.cache \ - /tmp/* + /tmp/* \ + /app/dist.zip COPY --chmod=755 backend/src/. . COPY --chmod=755 backend/src/docker / diff --git a/webui/.husky/pre-commit b/webui/.husky/pre-commit new file mode 100644 index 00000000..9c2a7dd9 --- /dev/null +++ b/webui/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +cd ./webui && pnpm run lint:fix && pnpm run format diff --git a/webui/package.json b/webui/package.json index b2b1258a..78b9a5d5 100644 --- a/webui/package.json +++ b/webui/package.json @@ -4,6 +4,7 @@ "version": "0.0.0", "private": true, "scripts": { + "prepare": "cd .. && husky install ./webui/.husky", "build": "vue-tsc --noEmit && vite build", "dev": "vite", "format": "prettier --write .", @@ -43,6 +44,7 @@ "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-storybook": "^0.6.12", + "husky": "^8.0.3", "prettier": "^2.8.8", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/webui/pnpm-lock.yaml b/webui/pnpm-lock.yaml index fc0eb5d5..85333c53 100644 --- a/webui/pnpm-lock.yaml +++ b/webui/pnpm-lock.yaml @@ -1,4 +1,8 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false dependencies: '@headlessui/vue': @@ -78,6 +82,9 @@ devDependencies: eslint-plugin-storybook: specifier: ^0.6.12 version: 0.6.12(eslint@8.41.0)(typescript@4.9.5) + husky: + specifier: ^8.0.3 + version: 8.0.3 prettier: specifier: ^2.8.8 version: 2.8.8 @@ -6078,6 +6085,12 @@ packages: engines: {node: '>=10.17.0'} dev: true + /husky@8.0.3: + resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} diff --git a/webui/src/components/ab-edit-rule.vue b/webui/src/components/ab-edit-rule.vue index 2cfbdac5..bdb5e6fe 100644 --- a/webui/src/components/ab-edit-rule.vue +++ b/webui/src/components/ab-edit-rule.vue @@ -29,10 +29,10 @@ watch(show, (val) => { } }); -const showDeleteFileDialog = (type: 'disable' | 'delete') => { +function showDeleteFileDialog(type: 'disable' | 'delete') { deleteFileDialog.show = true; deleteFileDialog.type = type; -}; +} const close = () => (show.value = false); diff --git a/webui/src/components/layout/ab-topbar.vue b/webui/src/components/layout/ab-topbar.vue index 2a2b8352..724b473d 100644 --- a/webui/src/components/layout/ab-topbar.vue +++ b/webui/src/components/layout/ab-topbar.vue @@ -1,11 +1,11 @@