From ba041d4fe20e636ee433fbc58abcef285b8e047a Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sun, 3 Jan 2021 16:32:06 +0100 Subject: [PATCH] CI setup w/ self-hosted drone & github actions. --- .drone.yml | 51 +++++++++++++++++++++++++++++++++++ .github/workflows/node.js.yml | 29 ++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 .drone.yml create mode 100644 .github/workflows/node.js.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6d13b33 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,51 @@ +--- +kind: pipeline +type: docker +name: blog_kevins-lab + +platform: + os: linux + arch: amd64 + +steps: +- name: frontend_install + image: node:14 + commands: + - node -v + - yarn --version +- name: backend_build + image: node:14 + commands: + - node -v + - yarn --version + - yarn + - yarn build +- name: deploy + image: appleboy/drone-ssh + pull: true + secrets: + - ssh_key + when: + event: + - push + branch: + - main + - drone-test + status: success + settings: + host: 10.0.0.58 + username: root + key: + from_secret: ssh_key + command_timeout: 600s + script: + - /root/blog-deploy.sh + +trigger: + branch: + - main + event: + include: + - pull_request + - push + diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..61e20be --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,29 @@ +# This workflow will do a clean install of node dependencies and builds the frontend source code across different versions of node. +# It should also run backend tests. +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: github actions build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.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: yarn + - run: yarn build