Build and Deploy Hugo Website #1545
This file contains hidden or 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: | |
| workflow_dispatch: | |
| push: | |
| branches: main | |
| schedule: | |
| - cron: "21 14 * * *" | |
| #concurrency: | |
| # cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Git submodule update | |
| run: | | |
| git pull --recurse-submodules | |
| git submodule update --remote --recursive | |
| - name: Pull down Git LFS files | |
| run: | | |
| git lfs fetch | |
| git lfs checkout | |
| - name: Setup Hugo | |
| env: | |
| HUGO_VERSION: 0.143.1 | |
| run: | | |
| curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz | |
| tar -xvzf hugo.tar.gz | |
| sudo mv hugo /usr/local/bin | |
| - name: Install SSH Key | |
| run: | | |
| install -m 600 -D /dev/null ~/.ssh/id_rsa | |
| echo "${{ secrets.BUILD_SSH_KEY }}" > ~/.ssh/id_rsa | |
| echo "${{ secrets.HOST_KEY }}" > ~/.ssh/known_hosts | |
| cat <<EOL > ~/.ssh/config | |
| Host Rozek-Nimbus | |
| Hostname 158.69.216.99 | |
| User build | |
| IdentityFile ~/.ssh/id_rsa | |
| EOL | |
| - name: Build Hugo Website | |
| id: build | |
| run: | | |
| hugo | |
| - name: Deploy | |
| run: ./deploy.sh | |
| - name: Install Onion SSH Key | |
| run: | | |
| install -m 600 -D /dev/null ~/.ssh/id_onion | |
| echo "${{ secrets.ONION_BUILD_SSH_KEY }}" > ~/.ssh/id_onion | |
| cat <<EOL >> ~/.ssh/config | |
| Host Rozek-Nimbus-Onion | |
| Hostname 158.69.216.99 | |
| User build | |
| IdentityFile ~/.ssh/id_onion | |
| EOL | |
| - name: Build Onion Website | |
| run: | | |
| hugo --baseURL "http://brozek63j22jry6gof2vszo27vh2ed327bqismqu3somrqu622z73eid.onion/" --destination "public-onion" | |
| - name: Deploy onion website | |
| run: | | |
| rsync -Pazc --exclude=*.bak --delete public-onion/ build@Rozek-Nimbus-Onion:brandonrozek-onion/ |