Added fellowship candidates to course2023 #505
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: "Ruby on Rails CI" | |
on: | |
push: | |
branches: [ master, staging ] | |
pull_request: | |
branches: [ master, staging ] | |
jobs: | |
deploy-production: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_nwspk_production | |
chmod 600 ~/.ssh/id_nwspk_production | |
cat >> ~/.ssh/config << EOF | |
Host nwspk-production | |
HostName 167.99.205.98 | |
User deploy | |
IdentityFile ~/.ssh/id_nwspk_production | |
StrictHostKeyChecking no | |
EOF | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.PRODUCTION_SSH_PRIVATE_KEY }} | |
- name: Pull latest changes | |
run: ssh nwspk-production "cd /var/www/web && git pull" | |
- name: Install dependencies | |
run: ssh nwspk-production "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && bundle install" | |
- name: Run migrations | |
run: ssh nwspk-production "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && rails db:migrate" | |
- name: Compile static assets | |
run: ssh nwspk-production "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && rails assets:precompile" | |
- name: Reload application | |
run: | | |
ssh nwspk-production "sudo systemctl restart nwspk-web.service" | |
ssh nwspk-production "sudo systemctl restart nwspk-sidekiq.service" | |
deploy-staging: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_nwspk_staging | |
chmod 600 ~/.ssh/id_nwspk_staging | |
cat >> ~/.ssh/config << EOF | |
Host nwspk-staging | |
HostName 165.232.96.89 | |
User deploy | |
IdentityFile ~/.ssh/id_nwspk_staging | |
StrictHostKeyChecking no | |
EOF | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.STAGING_SSH_PRIVATE_KEY }} | |
- name: Pull latest changes | |
run: ssh nwspk-staging "cd /var/www/web && git pull" | |
- name: Install dependencies | |
run: ssh nwspk-staging "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && bundle install" | |
- name: Run migrations | |
run: ssh nwspk-staging "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && rails db:migrate" | |
- name: Compile static assets | |
run: ssh nwspk-staging "cd /var/www/web && source .envrc && export PATH=/home/deploy/.rbenv/shims:$PATH && rails assets:precompile" | |
- name: Reload application | |
run: | | |
ssh nwspk-staging "sudo systemctl restart nwspk-web.service" | |
ssh nwspk-staging "sudo systemctl restart nwspk-sidekiq.service" |