Skip to content

Better WS display

Better WS display #626

Workflow file for this run

# sudo nano /etc/systemd/system/puma_portfolio_production.service
# sudo /bin/systemctl restart puma_portfolio_production
# sudo /bin/systemctl start puma_portfolio_production
# journalctl -r -u puma_portfolio_production.service
# systemctl status puma_portfolio_production.service
# check syntax error with `sc`
# (local) bundle exec cap production deploy
name: Deploy after merge
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get Commit Details
id: commit_info
run: |
merge_sha=$(git rev-parse HEAD)
sha=$(git rev-list --no-merges -n 1 HEAD)
author=$(git log -1 --pretty=format:'%an' $sha)
message=$(git log -1 --pretty=format:'%s' $sha)
echo "::set-output name=merge::$merge_sha"
echo "::set-output name=sha::$sha"
echo "::set-output name=author::$author"
echo "::set-output name=message::$message"
- name: Begin Deploy
run: |
curl -X POST -H "Authorization: Bearer ${{ secrets.PORTFOLIO_ACCESS_KEY }}" \
-d "id=deploy&deploy=start&merge=${{ steps.commit_info.outputs.merge }}&sha=${{ steps.commit_info.outputs.sha }}&author=${{ steps.commit_info.outputs.author }}&message=${{ steps.commit_info.outputs.message }}" \
https://ardesian.com/jil/trigger/monitor
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
- name: Install dependencies
run: |
gem install bundler
bundle install
- name: Deploy to Digital Ocean
env:
SSH_PRIVATE_KEY: /tmp/ssh_key
run: |
eval `ssh-agent -s` # Manually start ssh-agent
mkdir -p /home/runner/.ssh # /home/runner is the Github Action directory
ssh-keyscan 165.227.15.235 >> /home/runner/.ssh/known_hosts
echo "${{ secrets.PORTFOLIO_DEPLOY_SSH_KEY }}" > /home/runner/.ssh/github_actions
chmod 600 /home/runner/.ssh/github_actions
ssh-agent -a $SSH_PRIVATE_KEY > /dev/null
ssh-add /home/runner/.ssh/github_actions
bundle exec cap production deploy
- name: Handle Deploy Failure
if: failure()
run: |
curl -X POST -H "Authorization: Bearer ${{ secrets.PORTFOLIO_ACCESS_KEY }}" \
-d "id=deploy&deploy=failed&sha=${{ steps.commit_info.outputs.sha }}" \
https://ardesian.com/jil/trigger/monitor