diff --git a/.github/actions/deploy-action/action.yml b/.github/actions/deploy-action/action.yml new file mode 100644 index 0000000000..1536a92df0 --- /dev/null +++ b/.github/actions/deploy-action/action.yml @@ -0,0 +1,8 @@ +name: 'deploy-action' +description: 'Install, Build and deploy hugo app in surge' +outputs: + deployed-domain: # id of output + description: 'Surge deploy domain URL.' +runs: + using: 'docker' + image: '../../../Dockerfile' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..328ce9bdfe --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +name: ci + +on: + pull_request: + branches: + - newsite + + push: + branches: + - newsite + +jobs: + deploy: + name: Deploy on surge + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 10 + python-version: + - 3.7 + steps: + - uses: actions/checkout@master + - name: deploy in surge + uses: ./.github/actions/deploy-action + id: deploy + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN}} + SURGE_LOGIN: ${{ secrets.SURGE_LOGIN}} + REF: ${{ github.ref}} + - name: Get the deployed-domain + run: echo "The deployed-domain is ${{ steps.deploy.outputs.deployed-domain }}" diff --git a/.gitignore b/.gitignore index 496ee2ca6a..d09b6f237b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,204 @@ -.DS_Store \ No newline at end of file +*.swp +*.pyd +*.so +*.o +*.lo +*.la +*~ +*.bak +*.swp +.\#* +.deps +.libs +.tox +*/**/_build +*/**/build +__pycache__ +**/*.egg-info +/dist + + +.mypy_cache +*/*.pyc +*/*.so* +*/**/__pycache__ +*/**/*.dylib* +*/**/*.pyc +*/**/*.pyd +*/**/*.so* +*/**/**/*.pyc +*/**/**/**/*.pyc +*/**/**/**/**/*.pyc + +*/**/make.dat + +*.egg-info +*.egg +*build/ +.tox +.coverage +*.DS_Store +*.sass-cache +*.map +.ropeproject/ +.ruby-version +dist/ +bower_components/ +node_modules +npm-debug.log +package-lock.json + + +# IPython notebook checkpoints +.ipynb_checkpoints + +# Editor temporaries +*.swn +*.swo +*.swp +*.swm +*~ + +# macOS dir files +.DS_Store + +# Symbolic files +tools/shared/cwrap_common.py + +# Ninja files +.ninja_deps +.ninja_log +compile_commands.json +*.egg-info/ +docs/source/scripts/activation_images/ + +## General + +# Compiled Object files +*.slo +*.lo +*.o +*.cuo +*.obj + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Compiled protocol buffers +*.pb.h +*.pb.cc +*_pb2.py + +# Compiled python +*.pyc +*.pyd + +# Compiled MATLAB +*.mex* + +# IPython notebook checkpoints +.ipynb_checkpoints + +# Editor temporaries +*.swn +*.swo +*.swp +*~ + +# Sublime Text settings +*.sublime-workspace +*.sublime-project + +# Eclipse Project settings +*.*project +.settings + +# QtCreator files +*.user + +# PyCharm files +.idea + +# OSX dir files +.DS_Store + +# GDB history +.gdb_history + +## Caffe2 + +# build, distribute, and bins (+ python proto bindings) +build +build_host_protoc +build_android +build_ios +/build_* +.build_debug/* +.build_release/* +distribute/* +*.testbin +*.bin +cmake_build +.cmake_build +gen +.setuptools-cmake-build +.pytest_cache +aten/build/* + +# Bram +plsdontbreak + +# Generated documentation +docs/_site +docs/gathered +_site +doxygen +docs/dev + +# LevelDB files +*.sst +*.ldb +LOCK +CURRENT +MANIFEST-* + +# generated version file +caffe2/version.py + +# setup.py intermediates +.eggs +caffe2.egg-info + +# Atom/Watchman required file +.watchmanconfig + +# Files generated by CLion +cmake-build-debug + +# Files generated by ctags +CTAGS +tags +TAGS + +# BEGIN NOT-CLEAN-FILES (setup.py handles this marker. Do not change.) +# +# Below files are not deleted by "setup.py clean". + +# Visual Studio Code files +.vscode +.vs + +# YouCompleteMe config file +.ycm_extra_conf.py + +# Files generated when a patch is rejected +*.orig +*.rej \ No newline at end of file diff --git a/.scripts/build.sh b/.scripts/build.sh new file mode 100644 index 0000000000..561da445a9 --- /dev/null +++ b/.scripts/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +hugo diff --git a/.scripts/deploy.sh b/.scripts/deploy.sh new file mode 100755 index 0000000000..cb92fbe292 --- /dev/null +++ b/.scripts/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +npm install -g surge + +echo "REF value is ${REF}" + +PR_NUMBER="$(echo $REF | cut -d'/' -f3)" +echo "PR_NUMBER: $PR_NUMBER" + + +surge --project "./public" --domain "pr-${PR_NUMBER}-numpy.org-newsite.surge.sh"; + +echo ::set-output name=deployed-domain::"pr-${PR_NUMBER}-numpy.org-newsite.surge.sh" diff --git a/.scripts/install.sh b/.scripts/install.sh new file mode 100644 index 0000000000..94f7db4fc0 --- /dev/null +++ b/.scripts/install.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ +| grep "browser_download_url.*hugo_[^extended].*_Linux-64bit\.tar\.gz" \ +| cut -d ":" -f 2,3 \ +| tr -d \" \ +| wget -qi - + +tarball="$(find . -name "*Linux-64bit.tar.gz")" + +tar -xzf $tarball + +chmod +x hugo + +mv hugo /usr/local/bin/ + +location="$(which hugo)" +echo "Hugo binary location: $location" + +version="$(hugo version)" +echo "Hugo binary version: $version" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..8ef90c97b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:10-alpine +ADD . ./app +WORKDIR /app + +RUN apk add --no-cache curl +RUN apk add --no-cache wget +RUN apk add --no-cache bash + +RUN chmod +x .scripts/install.sh +RUN chmod +x .scripts/build.sh +RUN chmod +x .scripts/deploy.sh + +RUN .scripts/install.sh +RUN .scripts/build.sh + +RUN echo ${REF} +RUN echo "$REF" +RUN export PR_NUMBER=$(echo ${REF} | cut -d'/' -f3) + +ENTRYPOINT .scripts/deploy.sh; /bin/bash