This commit is contained in:
frederikpyt 2020-08-06 08:37:28 +02:00
commit f4a277185d
5 changed files with 84 additions and 21 deletions

35
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: CD
on:
push:
branches: [ production ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: a0a2dd521e6af856629d95da2a32f196957a78b0
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: cd skolehjem
- run: npm install
- run: npm run production
- name: Commit built assets
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git checkout -B deploy
git add -f public/
git commit -m "Build front-end assets"
git push -f origin deploy
- name: Deploy to production
uses: appleboy/ssh-action@master
with:
username: ekapp
host: sebathefox.dk
password: Aa123456&
script: 'cd /home/ekapp/public_html/skolehjem && ./server_deploy.sh'

29
server_deploy.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
set -e
echo "Deploying application ..."
# Enter maintenance mode
(php artisan down --message 'The app is being (quickly!) updated. Please try again in a minute.') || true
# Update codebase
git fetch origin deploy
git reset --hard origin/deploy
# Install dependencies based on lock file
composer install --no-interaction --prefer-dist --optimize-autoloader
# Migrate database
php artisan migrate --force
# Note: If you're using queue workers, this is the place to restart them.
# ...
# Clear cache
php artisan optimize
# Reload PHP to update opcache
echo "" | sudo -S service php7.4-fpm reload
# Exit maintenance mode
php artisan up
echo "Application deployed!"

View File

@ -381,7 +381,7 @@ class UserController extends Controller
foreach ($roles as $role) {
if($user->hasRole($role)) {
array_push($users, $user);
break 1;
break 2;
}
}
}

View File

@ -29,20 +29,13 @@
<script>
ClassicEditor
.create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h3', title: 'Heading 1', class: 'sde-blue' },
{ model: 'heading2', view: 'h4', title: 'Heading 2', class: 'sde-blue' }
]
}
.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( editor );
} )
.catch( error => {
console.log( error );
console.error( error );
} );
</script>
@endsection

View File

@ -10,20 +10,26 @@
@endsection
@section("content")
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
<h1>Opret Menuplan:</h1>
<form action="{{ action('MenuPlanController@store') }}" method="post">
@csrf
<label for="week">Uge nr.</label>
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
<label for="monday">Mandag:</label>
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required>
<label for="tuesday">Tirsdag:</label>
<input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required>
<label for="wednesday">Onsdag:</label>
<input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required>
<label for="thursday">Torsdag:</label>
<input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required>
<textarea name="menuPlan" id="editor"></textarea>
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
</form>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( editor );
} )
.catch( error => {
console.error( error );
} );
</script>
@endsection