diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..7531360af508208ecaa6f36387ddb54f2093cae4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,55 @@ +# Uses latest NodeJS +image: node:latest + +# And to cache them as well. +cache: + paths: + - node_modules/ + - .yarn + +# You specify the stages. Those are the steps that GitLab will go through +# Order matters. +stages: + - build + - upload + - release + +variables: + PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/releases" + +Build: + stage: build + rules: + - if: $CI_COMMIT_TAG # Run this job when a tag is created manually + before_script: + - yarn config set cache-folder .yarn + - yarn install + script: + - yarn build + - cd target + - tar -czvf ../chatterbox-$CI_COMMIT_TAG.tar.gz * + artifacts: + paths: + - chatterbox-$CI_COMMIT_TAG.tar.gz + expire_in: 1 hour + +Upload: + stage: upload + image: curlimages/curl:latest + rules: + - if: $CI_COMMIT_TAG + dependencies: + - Build + script: + - | + curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "chatterbox-${CI_COMMIT_TAG}.tar.gz" "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/chatterbox-${CI_COMMIT_TAG}.tar.gz" + +Release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - if: $CI_COMMIT_TAG + script: + - | + release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ + --assets-link "{\"name\":\"chatterbox-$CI_COMMIT_TAG.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/chatterbox-$CI_COMMIT_TAG.tar.gz\"}" \ \ No newline at end of file diff --git a/package.json b/package.json index 1fc299be523f36faa77a2f0f0ee89cf6fe51fd70..29dfc65332adf2047ce2c96abf1e7293ddd9ad41 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "scripts": { "start": "vite", - "build": "tsc && vite build && vite build --config parent-vite.config.js", + "build": "tsc && vite build && vite build --config parent-vite.config.js && scripts/after-build.sh", "preview": "vite preview" }, "devDependencies": { diff --git a/public/config.json b/public/config.json index 5290951786562c654ff7f038aecc484e3b2662ab..8ca7fbcc79e89b90209f14ff502410645dd540c5 100644 --- a/public/config.json +++ b/public/config.json @@ -1,5 +1,5 @@ { - "homeserver": "http://localhost:8008", - "auto_join_room": "!KiuRShFqxJLSoshNKa:localhost:8008", - "username_prefix": "testcorp" + "homeserver": "https://matrix.midhun.dev", + "auto_join_room": "!XOUozZcpOvneVFsrGi:matrix.midhun.dev", + "username_prefix": "foobar" } diff --git a/scripts/after-build.sh b/scripts/after-build.sh new file mode 100755 index 0000000000000000000000000000000000000000..5142c0e739e3d33775590833d21b03ff44c176d7 --- /dev/null +++ b/scripts/after-build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Running after-build tasks ..." +find target/assets/ -name "parent.*.js" -exec rm -vf {} \; +find target/assets/ -name "parent.*.css" -exec rm -vf {} \; +rm -vf target/index.html +mv -v target/parent/assets/* target/assets/ +rm -rfv target/parent