diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..01b8fb3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,55 @@ +stages: + - build + - deploy + +# cache using branch name +# https://gitlab.com/help/ci/caching/index.md +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - frontend/node_modules + +build:blobs: + image: golang:1.17 + stage: build + script: + - mkdir blobs/ + - make wasm + - make build-cross-clis + - mv covergen.wasm dist blobs/ + # Grab the wasm shim from the docker image + - cp /usr/local/go/misc/wasm/wasm_exec.js blobs/wasm_exec.js + artifacts: + paths: + - blobs/ + expire_in: 30 days + +build:frontend: + image: node:16 + stage: build + needs: + - build:blobs + before_script: + - cd frontend/ + - corepack npm install --immutable + script: + - mv ../blobs/* public + - corepack npm run build + artifacts: + paths: + - frontend/dist/ + expire_in: 30 days + +deploy: + stage: deploy + image: alpine + needs: + - build:frontend + before_script: + - apk add lftp + script: + - cd frontend/ + - lftp "$DEPLOY_USER_PASS@vps0.miwebb.com:/" -e "mirror -R dist/ .; quit" + environment: + name: live + url: https://covergen.miwebb.dev \ No newline at end of file diff --git a/frontend/public/.htaccess b/frontend/public/.htaccess new file mode 100644 index 0000000..1a8944b --- /dev/null +++ b/frontend/public/.htaccess @@ -0,0 +1,9 @@ +AddType application/wasm .wasm + + + RewriteEngine On + RewriteBase / + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule (.*) /index.html [QSA,L] + diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 43f6eaa..46627ea 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -5,7 +5,7 @@ import { resolve } from 'path'; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ plugins: [vue()], - base: mode === 'production' ? '/covergen/' : '/', + base: '/', resolve: { alias: { '@': resolve(__dirname, './src'),