Skip to content
This repository was archived by the owner on Sep 26, 2024. It is now read-only.

Commit be0905c

Browse files
committed
Add automated deployment using middleman deploy
1 parent cfc1b99 commit be0905c

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
name: Update live developer docs
1+
name: Build developer docs (and deploy on push)
22

33
on:
44
push:
55
branches:
66
- master
7+
pull_request:
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
1112

1213
steps:
13-
- name: update live developer docs using SSH
14-
uses: garygrossgarten/github-action-ssh@release
14+
- uses: actions/checkout@v2
15+
- uses: ruby/setup-ruby@v1
1516
with:
16-
command: cd /var/www/developer && git pull && bundle install --quiet && bundle exec middleman build | grep -E '\b(create|delete|error|update)\b'
17-
host: ${{ secrets.SSH_HOST }}
18-
username: ${{ secrets.SSH_USER }}
19-
passphrase: ${{ secrets.SSH_PASSPHRASE }}
20-
privateKey: ${{ secrets.SSH_PRIVATE_KEY }}
17+
ruby-version: 2.3.1
18+
bundler-cache: true
19+
- name: install deps
20+
run: bundle install
21+
- name: build docs
22+
run: bundle exec middleman build
23+
- name: deploy docs
24+
if: ${{ github.event_name == 'push' }}
25+
run: bundle exec middleman deploy
26+
env:
27+
SSH_HOST: ${{ secrets.SSH_HOST }}
28+
SSH_DEPLOYMENT_PATH: ${{ secrets.SSH_PATH }}
29+
SSH_USER: ${{ secrets.SSH_USER }}
30+
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ gem "middleman-syntax"
1212
# Plugin for middleman to generate Github pages
1313
gem 'middleman-gh-pages'
1414

15+
# For deploying to Mautic's live server
16+
gem 'middleman-deploy', '~> 1.0'
17+
1518
# Live-reloading plugin
1619
gem "middleman-livereload", "~> 3.3.0"
1720

@@ -27,4 +30,4 @@ end
2730

2831
gem "rake", "~> 12.3.3"
2932

30-
gem 'therubyracer', :platforms => :ruby
33+
gem 'therubyracer', :platforms => :ruby

Gemfile.lock

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ GEM
7272
rack-test (~> 0.6.2)
7373
thor (>= 0.15.2, < 2.0)
7474
tilt (~> 1.4.1, < 2.0)
75+
middleman-deploy (1.0.0)
76+
middleman-core (>= 3.2)
77+
net-sftp
78+
ptools
7579
middleman-gh-pages (0.3.1)
7680
rake (> 0.9.3)
7781
middleman-livereload (3.3.4)
@@ -88,12 +92,16 @@ GEM
8892
rouge (~> 1.0)
8993
minitest (5.9.0)
9094
multi_json (1.15.0)
95+
net-sftp (3.0.0)
96+
net-ssh (>= 5.0.0, < 7.0.0)
97+
net-ssh (6.1.0)
9198
padrino-helpers (0.12.8)
9299
i18n (~> 0.6, >= 0.6.7)
93100
padrino-support (= 0.12.8)
94101
tilt (~> 1.4.1)
95102
padrino-support (0.12.8)
96103
activesupport (>= 3.1)
104+
ptools (1.4.2)
97105
rack (1.6.13)
98106
rack-livereload (0.3.16)
99107
rack
@@ -139,6 +147,7 @@ PLATFORMS
139147

140148
DEPENDENCIES
141149
middleman (~> 3.3.0)
150+
middleman-deploy (~> 1.0)
142151
middleman-gh-pages
143152
middleman-livereload (~> 3.3.0)
144153
middleman-syntax
@@ -150,4 +159,4 @@ DEPENDENCIES
150159
wdm (~> 0.1.0)
151160

152161
BUNDLED WITH
153-
1.11.2
162+
1.17.3

config.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@
3535
# set :http_prefix, "/Content/images/"
3636
end
3737

38+
activate :deploy do |deploy|
39+
deploy.method = :sftp
40+
deploy.port = 22
41+
deploy.path = ENV["SSH_DEPLOYMENT_PATH"]
42+
deploy.host = ENV["SSH_HOST"]
43+
deploy.user = ENV["SSH_USER"]
44+
deploy.password = ENV["SSH_PASSWORD"]
45+
end

0 commit comments

Comments
 (0)