From 89b95007121c73a08309134716bd67876185239b Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:16:35 -0700 Subject: [PATCH 01/15] Add .drone.yml --- .drone.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9bd053b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,10 @@ +kind: pipeline +type: docker +name: default + +steps: +- name: greeting + image: alpine + commands: + - echo hello + - echo world \ No newline at end of file From b80dd9be99989e6cfb9b217355375b773f7e277d Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:21:26 -0700 Subject: [PATCH 02/15] limit drone execution --- .drone.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9bd053b..0e2b88c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,9 +2,14 @@ kind: pipeline type: docker name: default +when: + branch: + - drone + - main + steps: -- name: greeting - image: alpine - commands: - - echo hello - - echo world \ No newline at end of file + - name: greeting + image: alpine + commands: + - echo hello + - echo world From 37d0141b897ea2bedf9d7404022ef64fc5c4f9c7 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:23:28 -0700 Subject: [PATCH 03/15] actually limit drone execution --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 0e2b88c..31d22b7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,7 +2,7 @@ kind: pipeline type: docker name: default -when: +trigger: branch: - drone - main From df036a4edb83ace3907f40e04339497593da334a Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:31:07 -0700 Subject: [PATCH 04/15] build gatsby in drone --- .drone.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 31d22b7..68f338e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,8 +8,12 @@ trigger: - main steps: - - name: greeting - image: alpine - commands: - - echo hello - - echo world + - name: build + image: node + commands: + - yarn install + - yarn build + # environment: + # GATSBY_GOOGLE_ANALYTICS_ID: + # from_secret: staging_www_analytics_id + # # ... \ No newline at end of file From 6a9ddbcb3a6cc7ead354d4fffed0e93ed73f21a8 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:32:29 -0700 Subject: [PATCH 05/15] fix drone yml --- .drone.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index 68f338e..6fbdf4c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,11 +9,7 @@ trigger: steps: - name: build - image: node - commands: - - yarn install - - yarn build - # environment: - # GATSBY_GOOGLE_ANALYTICS_ID: - # from_secret: staging_www_analytics_id - # # ... \ No newline at end of file + image: node + commands: + - yarn install + - yarn build From 477dfd2ccbd14686a2073730e5c6dd89e88d5844 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:55:04 -0700 Subject: [PATCH 06/15] cache testing: yarn onloy --- .drone.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6fbdf4c..20b08c3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,6 +10,14 @@ trigger: steps: - name: build image: node + # volumes: + # - name: cache + # path: /tmp/cache commands: - yarn install - - yarn build + # - yarn build + +# volumes: +# - name: cache +# host: +# path: /mnt/user/dronecache From d31439a92a892ae039b271a9cd55bc152b91b9ef Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 11:57:33 -0700 Subject: [PATCH 07/15] mount /tmp/cache in node step --- .drone.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 20b08c3..3a2adaf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,14 +10,14 @@ trigger: steps: - name: build image: node - # volumes: - # - name: cache - # path: /tmp/cache + volumes: + - name: cache + path: /tmp/cache commands: - yarn install # - yarn build -# volumes: -# - name: cache -# host: -# path: /mnt/user/dronecache +volumes: + - name: cache + host: + path: /mnt/user/dronecache From fab155336e34a73160f014bb5574c1c92d1e1dab Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 12:10:07 -0700 Subject: [PATCH 08/15] try drillster/drone-volume-cache --- .drone.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.drone.yml b/.drone.yml index 3a2adaf..ea01911 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,6 +8,16 @@ trigger: - main steps: + - name: restore-cache + image: drillster/drone-volume-cache + settings: + restore: true + mount: + - ./node_modules + volumes: + - name: cache + path: /cache + - name: build image: node volumes: @@ -17,6 +27,16 @@ steps: - yarn install # - yarn build + - name: rebuild-cache + image: drillster/drone-volume-cache + settings: + rebuild: true + mount: + - ./node_modules + volumes: + - name: cache + path: /cache + volumes: - name: cache host: From e0a3b2aed9d050cccf2583c2b5b45da13fa0b334 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 12:12:41 -0700 Subject: [PATCH 09/15] remove unnecessary volume mount from build step image --- .drone.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index ea01911..402eda2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,9 +20,6 @@ steps: - name: build image: node - volumes: - - name: cache - path: /tmp/cache commands: - yarn install # - yarn build From efbfabb8abc13102bead2f26bc4975ab570dab3b Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 12:18:08 -0700 Subject: [PATCH 10/15] cache gatsby files --- .drone.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 402eda2..633e43a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,6 +14,8 @@ steps: restore: true mount: - ./node_modules + - ./.cache + - ./public volumes: - name: cache path: /cache @@ -22,7 +24,7 @@ steps: image: node commands: - yarn install - # - yarn build + - yarn build - name: rebuild-cache image: drillster/drone-volume-cache @@ -30,6 +32,8 @@ steps: rebuild: true mount: - ./node_modules + - ./.cache + - ./public volumes: - name: cache path: /cache From c5f933765da643bd4ddf7fc29fb434d82edc198d Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 12:50:49 -0700 Subject: [PATCH 11/15] deploy built website --- .drone.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.drone.yml b/.drone.yml index 633e43a..8df5327 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,6 +25,23 @@ steps: commands: - yarn install - yarn build + + - name: rsync + image: drillster/drone-rsync + settings: + user: ci + key: + from_secret: rsync_key + hosts: + - droplet.chuckdries.com + exclude: + - node_modules + - .git* + args: -zr + source: ./public + target: www/personal-website + delete: true + secrets: [ rsync_key ] - name: rebuild-cache image: drillster/drone-volume-cache From 38ccf874158dce2fde85dc5923c78bc57477649d Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 13:06:44 -0700 Subject: [PATCH 12/15] check size of output before uploading? --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 8df5327..d89c8bc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,6 +25,7 @@ steps: commands: - yarn install - yarn build + - ls -al public - name: rsync image: drillster/drone-rsync @@ -39,7 +40,7 @@ steps: - .git* args: -zr source: ./public - target: www/personal-website + target: ~/www/personal-website delete: true secrets: [ rsync_key ] From 1cf5295ddb463bf3639a937634765e638f73f40d Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 13:10:40 -0700 Subject: [PATCH 13/15] du instead of ls --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index d89c8bc..f1527f8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ steps: commands: - yarn install - yarn build - - ls -al public + - du -sh public - name: rsync image: drillster/drone-rsync From adecac2a398acb458c34be2e6309d9b906bde836 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 13:15:45 -0700 Subject: [PATCH 14/15] Delete github actions --- .github/workflows/main.yml | 47 ----------------------------------- .github/workflows/staging.yml | 47 ----------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/staging.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 4777bf4..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: build and deploy main - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [main] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build-and-deploy: - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - name: Set Node.js - uses: actions/setup-node@master - with: - node-version: 16.x - cache: yarn - - name: Install dependencies - run: yarn install --prod --pure-lockfile - - name: Gatsby cache - uses: actions/cache@v2 - with: - key: ${{ runner.os }}-gatsby-build-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-gatsby-build- - path: | - public - .cache - - name: Build - run: yarn run build - - name: upload - uses: burnett01/rsync-deployments@4.1 - with: - switches: -zr --delete --exclude node_modules --exclude '.git*' - path: ./public/ - remote_path: www/personal-website - remote_host: droplet.chuckdries.com - remote_user: ${{ secrets.CI_USER }} - remote_key: ${{ secrets.CI_SSH_KEY }} diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml deleted file mode 100644 index 07a2f0d..0000000 --- a/.github/workflows/staging.yml +++ /dev/null @@ -1,47 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: build and deploy staging - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [staging] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build-and-deploy: - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - name: Set Node.js - uses: actions/setup-node@master - with: - node-version: 16.x - cache: yarn - - name: Install dependencies - run: yarn install --prod --pure-lockfile - - name: Gatsby cache - uses: actions/cache@v2 - with: - key: ${{ runner.os }}-gatsby-build-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-gatsby-build- - path: | - public - .cache - - name: Build - run: yarn run build - - name: upload - uses: burnett01/rsync-deployments@4.1 - with: - switches: -zr --delete --exclude node_modules --exclude '.git*' - path: ./public/ - remote_path: www/personal-website-staging - remote_host: droplet.chuckdries.com - remote_user: ${{ secrets.CI_USER }} - remote_key: ${{ secrets.CI_SSH_KEY }} From d120673c34f464ad9768ba6e1208fab54b0a3a9c Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Sun, 10 Jul 2022 13:16:12 -0700 Subject: [PATCH 15/15] only build on main branch --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f1527f8..4e796cf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,7 +4,6 @@ name: default trigger: branch: - - drone - main steps: