From 8ee84cf61af0058fdf897aaa90db38a378d1df81 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Thu, 25 Jul 2019 16:14:37 +0200 Subject: [PATCH] add homepage to global setup --- .circleci/config.yml | 53 ++++++++++++++++++++++++++++++++++- Makefile | 1 + docker-compose.yml | 13 +++++++++ homepage/.circleci/config.yml | 45 ----------------------------- homepage/LICENSE | 21 -------------- 5 files changed, 66 insertions(+), 67 deletions(-) delete mode 100644 homepage/.circleci/config.yml delete mode 100644 homepage/LICENSE diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b78286..a717c53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -327,7 +327,6 @@ jobs: paths: - ~/offen/packages/node_modules key: offen-packages-{{ checksum "package.json" }} - - restore_cache: key: offen-auditorium-{{ checksum "auditorium/package.json" }} - run: @@ -363,6 +362,56 @@ jobs: $(npm bin)/sls deploy --config vault/serverless.yml $(npm bin)/sls client deploy --config vault/serverless.yml --no-confirm + deploy_homepage: + docker: + - image: circleci/python:3.6 + working_directory: ~/offen/homepage + environment: + - SOURCE_BRANCH: master + - TARGET_BRANCH: gh-pages + steps: + - checkout: + path: ~/offen + - restore_cache: + key: offen-homepage-{{ checksum "requirements.txt" }} + - run: + name: Install dependencies + command: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + - save_cache: + paths: + - ~/offen/homepage/venv + key: offen-homepage-{{ checksum "requirements.txt" }} + - run: + name: Deploy + command: | + source venv/bin/activate + + git config --global user.email $GH_EMAIL + git config --global user.name $GH_NAME + + git clone $CIRCLE_REPOSITORY_URL out + + cd out + git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH + git rm -rf . + cd .. + + make publish + + cp -a output/. out/. + + mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/. + cp CNAME out/CNAME + cd out + + git add -A + git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty + + git push origin $TARGET_BRANCH + workflows: version: 2 test_build_deploy: @@ -381,3 +430,5 @@ workflows: <<: *deploy_preconditions - deploy_python: <<: *deploy_preconditions + - deploy_homepage: + <<: *deploy_preconditions diff --git a/Makefile b/Makefile index b009c87..01fd2a6 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ setup: @docker-compose run server go mod download @docker-compose run kms go mod download @docker-compose run accounts pip install --user -r requirements.txt -r requirements-dev.txt + @docker-compose run homepage pip install --user -r requirements.txt @echo "Successfully built containers and installed dependencies." @echo "If this is your initial setup, you can run 'make bootstrap' next" @echo "to create the needed local keys and seed the database." diff --git a/docker-compose.yml b/docker-compose.yml index b541138..51e0f51 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -126,6 +126,18 @@ services: SERVER_HOST: http://server:8080 SESSION_SECRET: vndJRFJTiyjfgtTF + homepage: + build: + context: '.' + dockerfile: Dockerfile.python + working_dir: /offen/homepage + volumes: + - .:/offen + - homepagedeps:/root/.local + command: make devserver + ports: + - 8000:8000 + volumes: kmsdeps: serverdeps: @@ -133,3 +145,4 @@ volumes: auditoriumdeps: vaultdeps: accountdeps: + homepagedeps: diff --git a/homepage/.circleci/config.yml b/homepage/.circleci/config.yml deleted file mode 100644 index 0811176..0000000 --- a/homepage/.circleci/config.yml +++ /dev/null @@ -1,45 +0,0 @@ -version: 2 -jobs: - build: - branches: - ignore: - - gh-pages - docker: - - image: circleci/python:3.6 - working_directory: ~/repo - environment: - - SOURCE_BRANCH: master - - TARGET_BRANCH: gh-pages - steps: - - checkout - - deploy: - name: Deploy - command: | - if [ $CIRCLE_BRANCH == $SOURCE_BRANCH ]; then - python -m venv venv - source venv/bin/activate - pip install -r requirements.txt - - git config --global user.email $GH_EMAIL - git config --global user.name $GH_NAME - - git clone $CIRCLE_REPOSITORY_URL out - - cd out - git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH - git rm -rf . - cd .. - - make publish - - cp -a output/. out/. - - mkdir -p out/.circleci && cp -a .circleci/. out/.circleci/. - cp CNAME out/CNAME - cd out - - git add -A - git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty - - git push origin $TARGET_BRANCH - fi diff --git a/homepage/LICENSE b/homepage/LICENSE deleted file mode 100644 index a89c3d6..0000000 --- a/homepage/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 offen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.