Skip to content

Commit

Permalink
Merge branch '47-create-staging-server' into 42-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipstenu authored Aug 27, 2024
2 parents 92d5d02 + 5816f85 commit 58f0215
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
SOURCE: "public/"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "/home/${{ secrets.REMOTE_USER }}/jorjafox.net/"
TARGET: "/home/${{ secrets.REMOTE_USER }}/${{ secrets.REMOTE_HOST }}/"
57 changes: 57 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Generate and deploy Staging'

on:
push:
branches: [ trunk ]

jobs:
deploy-website:
runs-on: ubuntu-latest
steps:
- name: Do a git checkout including submodules
uses: actions/checkout@v4
with:
submodules: true

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SERVER_SSH_KEY }}
known_hosts: unnecessary

- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true

- name: Setup Node and Install
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
run: npm install && npm run mod:update

- name: Make Resources Folder locally
run: mkdir resources

- name: Download resources from server
run: rsync -rlgoDzvc -i ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:/home/${{ secrets.REMOTE_USER }}/${{ secrets.HUGO_RESOURCES_URL }}/ resources/

- name: Build site
run: npm run build

- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-rlgoDzvc -i"
SOURCE: "public/"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "/home/${{ secrets.REMOTE_USER }}/${{ secrets.STAGING_SERVER }}/"

0 comments on commit 58f0215

Please sign in to comment.