LeadDev London 2024 day 2 (#78) #323
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: Build And Test | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1.180.1 | |
with: | |
ruby-version: '3.2' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
bundle install | |
- name: Check Python | |
run: | | |
mypy *.py | |
- name: Code Style | |
run: | | |
./run_checks.sh | |
- name: Build | |
run: | | |
bundle exec jekyll build | |
release: | |
runs-on: ubuntu-latest | |
concurrency: release | |
environment: Production | |
if: github.repository == 'andrewjw/site' && github.ref == 'refs/heads/master' | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up SSH Key | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_rsa.pub | |
sudo chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1.180.1 | |
with: | |
ruby-version: '3.2' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
bundle install | |
- name: Build | |
run: | | |
GA_ID="${{ secrets.GA_ID }}" bundle exec jekyll build | |
cp requirements.txt _site/ | |
- name: Deploy | |
run: | | |
rsync -avc --delete _site/ ${{ secrets.SSH_USER}}@${{ secrets.SSH_HOST }}:site/ | |
ssh ${{ secrets.SSH_USER}}@${{ secrets.SSH_HOST }} sudo pip3 install -r site/requirements.txt |