2021-05-01 17:24:18 -04:00
|
|
|
name: Production Deploy
|
|
|
|
concurrency:
|
|
|
|
group: Production
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
|
|
|
|
|
|
|
|
jobs:
|
2021-05-02 15:43:11 -04:00
|
|
|
build:
|
|
|
|
name: Jekyll Build
|
2021-05-01 17:24:18 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-03-01 23:16:52 -05:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-01 17:24:18 -04:00
|
|
|
- uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
bundler-cache: true
|
2022-02-28 05:14:37 -05:00
|
|
|
- uses: actions/setup-node@v3
|
2021-05-01 17:24:18 -04:00
|
|
|
with:
|
|
|
|
node-version: '14'
|
2021-05-01 23:59:01 -04:00
|
|
|
- name: Cache Jekyll build
|
2022-03-22 00:11:23 -04:00
|
|
|
uses: actions/cache@v3
|
2021-05-01 23:59:01 -04:00
|
|
|
with:
|
2021-05-02 01:26:12 -04:00
|
|
|
path: |
|
|
|
|
.jekyll-cache
|
|
|
|
.sass-cache
|
|
|
|
key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }}
|
2021-05-02 15:43:11 -04:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install
|
2021-05-01 17:24:18 -04:00
|
|
|
- name: Build website
|
|
|
|
uses: ./.github/actions/build
|
2021-05-02 15:43:11 -04:00
|
|
|
- run: tar cvf site.tar _site
|
|
|
|
- name: Upload generated Jekyll site
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: generated-site
|
|
|
|
path: site.tar
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
name: Rsync Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: production
|
|
|
|
needs: build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download generated Jekyll site
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: generated-site
|
|
|
|
- run: tar xvf site.tar
|
2021-05-01 17:24:18 -04:00
|
|
|
- name: Copy built site to production
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
|
|
|
chmod 700 ~/.ssh/id_rsa
|
|
|
|
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
2022-02-15 18:26:24 -05:00
|
|
|
rsync -azP --delete _site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }}
|