Skip to content

Commit

Permalink
Reset
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickFuereder committed Mar 22, 2024
0 parents commit 678b54a
Show file tree
Hide file tree
Showing 15 changed files with 3,817 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "weekly"
87 changes: 87 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build & Deploy

on:
push:
branches: [ main ]

jobs:
build:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Npm Packages
uses: actions/setup-node@v4
with:
node-version: 21

- run: npm i

- run: npm run build

- name: Zip
run: |
touch build.tar.gz
tar -zcf build.tar.gz -C ./dist .
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: ./build.tar.gz

deploy:
needs: build
runs-on: ubuntu-latest
env:
SSH_USER: github
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: 194.36.146.51
REPO_NAME: ${{ github.event.repository.name }}
steps:
- name: Download build
uses: actions/download-artifact@v4
with:
name: build

- name: Install ssh key
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
- name: Configure SSH
run: |
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
- name: Check SSH Connection
run: ssh staging 'echo "It works!"'

- name: Delete previous deploy files
run: ssh staging "sudo rm -r /home/$SSH_USER/$REPO_NAME/*"
continue-on-error: true

- name: Deploy build
run: rsync -avz -e 'ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no' --progress ./build.tar.gz $SSH_USER@$SSH_HOST:/home/$SSH_USER/$REPO_NAME

- name: Unzip
run: ssh staging "cd /home/$SSH_USER/$REPO_NAME/ && sudo tar --no-same-owner --no-same-permissions -xf build.tar.gz"

- name: Delete build zip
run: ssh staging "cd /home/$SSH_USER/$REPO_NAME/ && sudo rm build.tar.gz"

- name: Delete current deployed files
run: ssh staging 'sudo rm -r -d /var/www/netdb'
continue-on-error: true

- name: Copy files
run: ssh staging "sudo rsync -av --ignore-existing /home/$SSH_USER/$REPO_NAME/ /var/www/netdb"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
143 changes: 143 additions & 0 deletions Assets/css/dialog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
.dialog-container {
width: 100%;
background-color: rgba(0, 0, 0, .5);
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 2000;
justify-content: center;
align-items: center;
display: none;
opacity: 0;
animation: fadein .5s forwards;
}

.dialog {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
background-color: #444;
flex-direction: column;
border-radius: 1em;
overflow: hidden;
min-width: 20%;
padding-bottom: 1em;
opacity: 0;
animation: fadein .5s forwards;
/* animation: scale .5s forwards; */
/* transform: scale(.75); */
}

@keyframes fadein {
from {
opacity: 0;
}

to {
opacity: 1;
}
}

@keyframes scale {
from {
transform: scale(.75);
}

to {
transform: scale(1);
}
}

.dialog-container.visible {
display: block;
}

.dialog-container.visible .dialog {
opacity: 1;
}

.dialog-title {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 1rem;
width: 100%;
color: white;
padding: .5em;
margin: 0;
}

.dialog-content {
margin-bottom: 1rem;
width: 100%;
padding: .5em 2em;
}

.dialog-button {
padding: 0.5rem 1rem;
border: 1px solid #ccc;
background-color: #fff;
cursor: pointer;
color: black;
width: 30%;
align-self: center;
border-radius: 11em;
}

.dialog-button:hover {
background-color: #ccc;
}

.dialog.info .dialog-title {
background-color: #3077d2;
}

.dialog.error .dialog-title {
background-color: #c11f1f;
}

.dialog.warning .dialog-title {
background-color: #ffa500;
}

.dialog.debug .dialog-title {
background-color: #888;
}

.dialog.pink .dialog-title {
background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
background-size: 1800% 1800%;
animation: rainbow 18s ease infinite;
}

@keyframes rainbow {
0% {
background-position: 0% 82%
}

50% {
background-position: 100% 19%
}

100% {
background-position: 0% 82%
}
}

.custom-dialog {
display: none;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: fixed;
z-index: 2100;
background-color: #444;
border-radius: 1em;
padding: 1em;
}

.custom-dialog.visible {
display: block;
}
Loading

0 comments on commit 678b54a

Please sign in to comment.