Skip to content

fix cat

fix cat #233

name: Deploy Production / HTW
on:
workflow_dispatch:
push:
tags:
- 'v*'
# branches:
# - 'main'
jobs:
hello:
if: false #github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: |
echo "say hello to main"
deploy:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
env:
WEBSSHKEY: ${{ secrets.WEBSSHKEY }}
HOST1: ${{ secrets.HOST1 }}
HOST2: ${{ secrets.HOST2 }}
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
- name: Install Bootstrap with npm
uses: actions/setup-node@v2
with:
node-version: '16'
- run: |
cd hugo
npm install
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.WEBSSHKEY }}
- name: Create Known Hosts File
run: |
cp bin/hugo_deployment/known_hosts ~/.ssh/known_hosts
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Write gitinfo file
run: bin/hugo_deployment/gitversion.sh ${{ github.ref }} ${{ github.sha }} "${{ github.workflow }}"
- name: Build Hugo Site
run: |
hugo --source hugo --destination ../public-htw --minify --environment htw
- name: Zip
run: |
zip -r website ./public-htw
pwd
- name: Copy Github->HTW
run: |
ssh $HOST1 "mkdir -p ~/hugo-tunnel"
scp website.zip $HOST1:~/hugo-tunnel/
- name: Unzip
run: |
ssh $HOST1 "cd ./hugo-tunnel ; unzip -o website.zip ; cd .."
- name: Copy Copy Script
run: |
scp bin/hugo_deployment/steps.sh $HOST1:~/steps.sh
- name: Copy to Server
run: |
echo "$WEBSSHKEY" | ssh $HOST1 'cat > ~/.tmp; chmod 600 ~/.tmp'
ssh $HOST1 "export set HOST2=$HOST2; . ~/steps.sh" 2>&1