chore: add default version #598
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Loger Demo Deployment | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.composer/cache/files | |
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1.2' | |
extensions: bcmath, ctype, dom, fileinfo, intl, gd, json, mbstring, pdo, pdo_sqlite, openssl, sqlite, xml, zip | |
- uses: actions/checkout@v3 | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.testing.example', '.env');" | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Create Database | |
run: | | |
mkdir -p database | |
touch database/database.sqlite | |
- name: Install Composer | |
run: composer test | |
- name: Build fronted | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
env: | |
APP_URL: ${{ secrets.DO_APP_URL }} | |
ASSET_URL: ${{ secrets.DO_APP_URL }} | |
APP_DEMO: true | |
VITE_APP_DEMO: true | |
- run: yarn; yarn build | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend-build | |
path: | | |
public/build | |
public/manifest.json | |
# - name: Execute tests (Unit and Feature tests) via PHPUnit | |
# env: | |
# DB_CONNECTION: sqlite | |
# DB_DATABASE: database/database.sqlite | |
# run: php artisan test | |
deploy: | |
if: ${{ github.event_name == 'push' }} | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: demo | |
url: https://loger.neatlancer.com/ | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DO_DOPLET_SECRET }} | |
known_hosts: unnecessary | |
- name: Adding Known Hosts | |
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Download frontend build | |
uses: actions/download-artifact@v3 | |
with: | |
name: frontend-build | |
path: public | |
- name: Store live name | |
run: git remote add live ${{ secrets.DO_REPO_URL }} | |
- name: Deploy with git | |
env: | |
branch_name: live_digital_ocean | |
run: | | |
echo "Deploy to staging server" | |
git config --global user.email "<>" | |
git config --global user.name "Action Bot" | |
git add . | |
git checkout -b $branch_name | |
git commit -m "deploy: build" | |
git push live $branch_name:master -f | |
echo "deployed to prod-staging" | |
- name: Update Composer PHP | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.DO_DOPLET_SECRET }} | |
script: | | |
cd /var/www/loger.com | |
composer update --ignore-platform-reqs |