diff --git a/.circleci/config.yml b/.circleci/config.yml index 51680d7..50f14fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,26 @@ jobs: root: /home/circleci/repo/public paths: - "*" + deploy: + working_directory: ~/repo + docker: + - image: circleci/openjdk:11-jdk-stretch-node-browsers + steps: + - checkout + - attach_workspace: + at: /home/circleci/repo/public + - restore_cache: + keys: + - build_cache-{{ checksum "package.json" }}-{{ checksum "shadow-cljs.edn" }} + - run: + name: Install dependencies + command: npm install + - run: + name: Deploy to gh-pages branch + command: | + git config user.email "build@circleci.com" + git config user.name "ci-build" + npm run deploy workflows: version: 2 @@ -60,3 +80,7 @@ workflows: ignore: - gh-pages - build + - deploy: + requires: + - test + - build diff --git a/README.md b/README.md index b2650e8..01e8523 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,12 @@ $ npm test # build and optimize the code once for production $ npm run build -# runs npm run build and publishes everything via gh-pages +# publishes everything via gh-pages $ npm run deploy ``` +There is continuous deployment set up on [circleci](https://circleci.com/gh/heyarne/airsonic-ui) that builds and deploys to `gh-pages` after a commit to the `master` branch. + **Note:** If you have a continuous build running and run `npm run build` or `npm run deploy`, it will delete the compiled tests, causing the continuous tests to not run anymore. This can be fixed by running `npm test` again. All build artifacts land in `/public`. Don't change anything in there as changes will be overwritten. diff --git a/package.json b/package.json index 4ae5782..efbb0ab 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "rm -r public/*; run-p copy:* build:*", "copy:assets": "cp -R src/assets/* public/", "copy:icons": "cp -R node_modules/open-iconic/font/fonts public", - "deploy": "npm run build && gh-pages -d public -m \"Deploying $(git rev-parse --short HEAD)\"", + "deploy": "gh-pages -d public -m \"Deploying $(git rev-parse --short HEAD)\"", "dev:cljs": "shadow-cljs watch app test", "dev:sass": "node-sass -w src/sass/app.sass -o public/app", "dev:test": "karma start --reporters notify,progress --auto-watch",