Commit b0647a04 authored by Andrew Okin's avatar Andrew Okin

Add job for deploying to test site

parent 07b31631
Pipeline #23 passed with stages
in 34 seconds
...@@ -8,25 +8,18 @@ cache: ...@@ -8,25 +8,18 @@ cache:
paths: paths:
- vendor - vendor
before_script:
# Ensure ssh-agent is installed
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Ensure rsync is installed
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
- bundle install --path=vendor
build: build:
stage: build stage: build
before_script:
- bundle install --path=vendor
script: script:
- bundle exec jekyll build - bundle exec jekyll build
artifacts: artifacts:
paths: paths:
- _site - _site
deploy: deploy_master:
stage: deploy extends: .deploy
dependencies:
- build
only: only:
refs: refs:
- master - master
...@@ -34,6 +27,32 @@ deploy: ...@@ -34,6 +27,32 @@ deploy:
name: production name: production
url: https://forkk.net url: https://forkk.net
script: script:
# Deploy the artifacts from the build stage
- rsync -a --delete _site/ "$SSH_DEPLOY_DEST"
deploy_test:
extends: .deploy
only:
refs:
- test
environment:
name: test
url: https://test.forkk.net
script:
# Deploy the artifacts from the build stage
- rsync -a --delete _site/ "$SSH_TEST_DEPLOY_DEST"
.deploy:
stage: deploy
dependencies:
- build
script: []
before_script:
# Ensure ssh-agent is installed
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Ensure rsync is installed
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
# Run ssh-agent (inside the build environment) # Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
...@@ -54,6 +73,3 @@ deploy: ...@@ -54,6 +73,3 @@ deploy:
- echo "$SSH_CONFIG" > ~/.ssh/config - echo "$SSH_CONFIG" > ~/.ssh/config
- chmod 644 ~/.ssh/config - chmod 644 ~/.ssh/config
# Deploy the artifacts from the build stage
- rsync -a --delete _site/ "$SSH_DEPLOY_DEST"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment