Add automatic deployment GH Action #4
Workflow file for this run
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 deploy HUGO website | |
on: | |
# Runs on pull requests to check that the website is building without errors | |
pull_request: | |
# Runs on push/merge to main to deploy the new website | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repo AND ITS SUBMODULES | |
- name: π Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Build the static website with the provided docker-compose rules | |
- name: π οΈ Build with HUGO | |
run: | | |
docker compose up builder | |
# Upload build artifacts for deployment or download | |
# - name: π Upload Artifacts | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: build | |
# path: ./build/blog | |
deploy: | |
needs: [build] | |
# if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: π οΈ Setup build directory | |
run: | | |
mkdir -p build/blog | |
# - name: π₯ Download build Artifacts | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: build | |
# path: build/blog | |
- name: π Create Key File | |
run: | | |
mkdir ~/.ssh | |
touch ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: π Populate Key | |
run: echo "${{ secrets.PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa | |
- run: | | |
tree | |
ll ~/.ssh | |
cat ~/.ssh/id_rsa |