2024-05-12 00:31:12 +02:00
|
|
|
name: Build and deploy website
|
|
|
|
on:
|
2024-08-05 16:40:48 +02:00
|
|
|
workflow_dispatch:
|
2024-05-12 00:31:12 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: docker
|
|
|
|
container:
|
2024-10-23 19:08:41 +02:00
|
|
|
image: registry.access.redhat.com/ubi9/nodejs-20:1-59.1726696138
|
2024-05-12 00:31:12 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2024-08-05 21:50:06 +02:00
|
|
|
run: npm ci
|
2024-05-12 00:31:12 +02:00
|
|
|
|
|
|
|
- name: Build site
|
2024-08-05 18:50:59 +02:00
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Configure SSH
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh/
|
|
|
|
echo "$SSH_KEY" | tr -d '\r' > ~/.ssh/actions.key
|
|
|
|
chmod 600 ~/.ssh/actions.key
|
2024-08-05 20:13:00 +02:00
|
|
|
cat << EOF > ~/.ssh/known_hosts
|
|
|
|
be.nick-slowinski.de ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOHcx9oD7InoNWdxPK8e0OZNlb6XuWQSrpWH5qrYKZH7
|
|
|
|
be.nick-slowinski.de ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCv2Ph8Q1H1ic7nGV7jsOmI7PPzKQIW530FVJkQPrPnd6PDBdhGy5H4MLF39loa+ukEfsNz2q2ijMJmF5vX0BwGSQJ1Dnz/+szSHBbrITE+pNoL2YgFYPaTlH2zEXsdsfelP9LGN7oPtFatJdZ6bhxjASurNg/4CaxHXO9KbVMDupiTERa6T+SsWPIxNcWTTkqxAb7Qulg/e4F4Nuxd4acBP7sQ4fvBYRPqdZCNrarKDvBJ5OSQujYiIidG/D6WI1vnoWJrTf83YdtqlmJXIQ6XIvIfMEOqHfthm2XXI3og8qWOpAyCMkxe3nJq+JE5duljznGwQUNkjtHZueA7RekTX9iTvY8n0bxmXtIxGLYtB4uUFmHU2PK6znNt6QssAG9zj6lqgEp4tccCcuQ+A+7rcwA54e5wSz2cLwiVsWw3Pc1OD74V6iolv9I52QScVO+L+l4QrtPEjqO6mj5SPvysJ3O7N537l2IPP09mrqz6bbNdBSEKzriajnz3k+7IUs0=
|
|
|
|
be.nick-slowinski.de ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKs8tSMD7rikpsfroI6SZ2yN+RxCrNfxhEDx/WGA22CMF5Vlc2I+fKH9/a1H4MOPlgBWsLrEeKXytxhp1gEnUEE=
|
|
|
|
EOF
|
2024-08-05 18:50:59 +02:00
|
|
|
env:
|
|
|
|
SSH_KEY: ${{ secrets.WEB_SSH_KEY }}
|
|
|
|
|
2024-08-05 21:44:15 +02:00
|
|
|
- name: Copy build to web server
|
2024-08-05 21:34:22 +02:00
|
|
|
run: scp -r -o "IdentitiesOnly=yes" -i ~/.ssh/actions.key build $WEB_SSH_USER@be.nick-slowinski.de:/var/www/nick-slowinski.de/www-tmp
|
2024-08-05 21:04:22 +02:00
|
|
|
env:
|
|
|
|
WEB_SSH_USER: ${{ secrets.WEB_SSH_USER }}
|
|
|
|
|
2024-08-05 21:44:15 +02:00
|
|
|
- name: Overwriting files
|
|
|
|
run: ssh -o "IdentitiesOnly=yes" -i ~/.ssh/actions.key $WEB_SSH_USER@be.nick-slowinski.de "rm -Rf /var/www/nick-slowinski.de/www && mv /var/www/nick-slowinski.de/www-tmp /var/www/nick-slowinski.de/www"
|
2024-08-05 19:07:04 +02:00
|
|
|
env:
|
2024-08-05 19:15:13 +02:00
|
|
|
WEB_SSH_USER: ${{ secrets.WEB_SSH_USER }}
|