Skip to content

Try deployment matchers (again) #56

Try deployment matchers (again)

Try deployment matchers (again) #56

Workflow file for this run

name: CI/CD
on:
push:
branches:
- master
workflow_dispatch:
env:
URL_PRD: loganmarchione.com
jobs:
deploy-development:
uses: ./.github/workflows/development.yml
secrets: inherit
deploy-production:
name: Deploy (loganmarchione.com)
needs: deploy-development
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --gc --baseURL="https://${{ env.URL_PRD }}"
- name: SSH setup
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ env.URL_PRD }} > ~/.ssh/known_hosts
chmod -R 700 ~/.ssh
chmod 600 ~/.ssh/deploy_key
- name: Rsync
run: |
rsync -rltvz --delete --omit-dir-times \
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.DEPLOY_PORT }}" public/ \
${{ secrets.DEPLOY_USER }}@${{ env.URL_PRD }}:/var/www/${{ env.URL_PRD }}