Skip to content

rename trigger events #311

rename trigger events

rename trigger events #311

name: Deploy Production / HTW
on:
workflow_dispatch:
push:
tags:
- 'v*'
# branches:
# - 'main'
repository_dispatch:
types: ["classes-module-tagged"]
jobs:
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@v4
with:
node-version: 'latest'
- run: |
npm install
- uses: webfactory/ssh-agent@v0.9.0
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@v3
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 mod get github.com/progwebtec/classes-module
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