Prod #263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prod | |
on: | |
push: | |
branches: [ master ] | |
schedule: | |
- cron: '0 5 * * *' | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Bundle install | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Add public IP to AWS security group | |
uses: sohelamin/aws-security-group-add-ip-action@master | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: 'us-east-1' | |
aws-security-group-id: ${{ secrets.AWS_SECURITY_GROUP_ID_PROD }} | |
port: '22' | |
description: 'GitHub Action' | |
- name: Setup SSH | |
uses: MrSquaare/ssh-setup-action@v1 | |
with: | |
host: ${{ secrets.LISTED_SSH_SERVER_PROD }} | |
private-key: ${{ secrets.LISTED_SSH_KEY_PROD }} | |
- name: Deploy with Capistrano | |
run: bundle exec cap production deploy | |
env: | |
LISTED_SSH_KEY_PATH: $HOME/.ssh/id_rsa | |
LISTED_SSH_USER: ${{ secrets.LISTED_SSH_USER_PROD }} | |
LISTED_SSH_SERVER: ${{ secrets.LISTED_SSH_SERVER_PROD }} | |
LISTED_SSH_DEPLOY_TO: ${{ secrets.LISTED_SSH_DEPLOY_TO_PROD }} |