Skip to content

GitHub actions for newsite branch #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2af4bcd
gitignore added
Shekharrajak Oct 2, 2019
82d2b21
grunt dependencies added in package.json
Shekharrajak Oct 2, 2019
590fd00
remove package.json
Shekharrajak Oct 2, 2019
74e4a12
github actions main.yml initially
Shekharrajak Oct 2, 2019
e073a72
build the hugo project script added
Shekharrajak Oct 2, 2019
9a0c948
deploy the hugo project script added
Shekharrajak Oct 2, 2019
ddd3647
install the hugo in docker container script added
Shekharrajak Oct 2, 2019
a524608
Dockerfile to run install, build, deploy scripts
Shekharrajak Oct 2, 2019
45158ce
Docker service uses
Shekharrajak Oct 2, 2019
831b49d
.github action - deploy action added and main.yml is using the action
Shekharrajak Oct 2, 2019
7af6ac2
deploy.sh is using the first arg
Shekharrajak Oct 2, 2019
b38d9d4
main.yml updated - run option not needed for the defined actions
Shekharrajak Oct 2, 2019
b487dba
action.yml should be in folder
Shekharrajak Oct 2, 2019
b5a7ccb
OS - ubuntu - docker container is only supported in linux in github a…
Shekharrajak Oct 2, 2019
676cf65
dockerfile should be in action folder
Shekharrajak Oct 2, 2019
d48c5ae
relative dockerfile path
Shekharrajak Oct 2, 2019
5477185
copy hugo project
Shekharrajak Oct 2, 2019
61ea985
move back to root directory
Shekharrajak Oct 2, 2019
13dd632
deploy.sh get the PR number from the REF env using cut pipe
Shekharrajak Oct 3, 2019
0e57ed8
remove the Test job and minor changes
Shekharrajak Oct 5, 2019
3c1de08
master checkout uses the branch code
Shekharrajak Oct 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/actions/deploy-action/action.yml
Original file line number Diff line number Diff line change
@@ -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'
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

- 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 }}"
205 changes: 204 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,204 @@
.DS_Store
*.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
3 changes: 3 additions & 0 deletions .scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

hugo
13 changes: 13 additions & 0 deletions .scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -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"
21 changes: 21 additions & 0 deletions .scripts/install.sh
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:10-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need node alpine? We might be able to use another image (something smaller, if it exists), although it probably doesn't really matter :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node docker image is used because later in deploy script it is installing the surge package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It maybe doesn't matter here, but Alpine is one of the most problematic distributions for Python packages, because it's musl rather than glibc based so manylinux wheels don't work if they contain compiled code. Just FYI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info.

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