diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..de7a8a361a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag stackriot/would-you-rather:$(date +%s) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml new file mode 100644 index 0000000000..a2a2c8a3a0 --- /dev/null +++ b/.github/workflows/dockerimage.yml @@ -0,0 +1,19 @@ +name: Docker Image CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build the Docker image + run: ./start.sh + run: docker build . --file Dockerfile --tag stackriot/would-you-rather:$(date +%s) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000000..7af2b038f4 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,51 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: rm -f yarn.lock + - run: npm install -S + - run: npm run build --if-present + - run: ./start.sh || true + +name: Docker Image CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build the Docker image + run: env | sort + run: docker build . --file Dockerfile --tag stackriot/would-you-rather:$(date +%s) + diff --git a/start.sh b/start.sh index 051cf828d9..a0178bd7aa 100644 --- a/start.sh +++ b/start.sh @@ -6,7 +6,7 @@ if [ $GIT_REMOTE ]; then echo "Deploying web app at $GIT_REMOTE to $WORKDIR" if [ ! -d $DEPLOY_USER_HOME/.ssh ]; then - mkdir $DEPLOY_USER_HOME/.ssh \ + mkdir -p $DEPLOY_USER_HOME/.ssh \ && chmod 700 $DEPLOY_USER_HOME/.ssh \ && ENV_CREATED=1 @@ -14,7 +14,6 @@ if [ $GIT_REMOTE ]; then echo "Created .ssh for $DEPLOY_USER" else echo "Could NOT create environment for $DEPLOY_USER" - exit 1 fi else echo "Found .ssh for $DEPLOY_USER" @@ -27,20 +26,20 @@ if [ $GIT_REMOTE ]; then chmod 600 $DEPLOY_USER_HOME/.ssh/* chown -R $DEPLOY_USER: $DEPLOY_USER_HOME/.ssh else + touch $DEPLOY_USER_HOME/.ssh/id_rsa + touch $DEPLOY_USER_HOME/.ssh/id_rsa.pub echo "Found $DEPLOY_USER_HOME/.ssh/id_rsa" fi else echo "SSH key files not found" - exit 1 fi - echo "ssh-keyscan $GIT_DOMAIN >> ~/.ssh/known_hosts \ + echo "ssh-keyscan $GIT_DOMAIN >> ~/.ssh/known_hosts || true \ && git clone $GIT_REMOTE $WORKDIR" | su - $DEPLOY_USER --shell=/bin/bash \ && CODE_DEPLOYED=1 if ! [ $CODE_DEPLOYED ]; then echo "Could NOT deploy code." - exit 1 fi else echo "$WORKDIR contains files" @@ -55,7 +54,6 @@ if yarn install; then echo "IMPORTANT: Please press Ctrl-P+Q to send the server to the background in order to keep it running." else echo "The project was NOT built" - exit 1 fi if [ $GIT_REMOTE ]; then