name: Build and deploy website on: workflow_dispatch: jobs: build: runs-on: docker container: image: registry.access.redhat.com/ubi9/nodejs-20:1-48.1720017855 steps: - name: Checkout code uses: actions/checkout@v4 - name: Install dependencies run: npm ci - name: Build site 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 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 env: SSH_KEY: ${{ secrets.WEB_SSH_KEY }} - name: Copy build to web server 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 env: WEB_SSH_USER: ${{ secrets.WEB_SSH_USER }} - 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" env: WEB_SSH_USER: ${{ secrets.WEB_SSH_USER }}