fixing test and deploy script
This commit is contained in:
@@ -75,18 +75,43 @@ jobs:
|
|||||||
- name: Build frontend assets
|
- name: Build frontend assets
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Upload deployment artifact
|
||||||
|
uses: actions/upload-artifact@v3.2.2-node20
|
||||||
|
with:
|
||||||
|
name: laravel-build
|
||||||
|
path: |
|
||||||
|
app
|
||||||
|
bootstrap
|
||||||
|
config
|
||||||
|
database
|
||||||
|
public
|
||||||
|
resources
|
||||||
|
routes
|
||||||
|
vendor
|
||||||
|
artisan
|
||||||
|
composer.json
|
||||||
|
package.json
|
||||||
|
vite.config.js
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy
|
name: Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Download build artifact
|
||||||
uses: actions/checkout@v4
|
uses: actions/download-artifact@v3-node20
|
||||||
|
with:
|
||||||
|
name: laravel-build
|
||||||
|
path: release
|
||||||
|
|
||||||
- name: Install sshpass
|
- name: Install sshpass
|
||||||
run: sudo apt-get update && sudo apt-get install -y sshpass
|
run: sudo apt-get update && sudo apt-get install -y sshpass
|
||||||
|
|
||||||
|
- name: Install rsync
|
||||||
|
run: sudo apt-get install -y rsync
|
||||||
|
|
||||||
- name: Add SSH host to known_hosts
|
- name: Add SSH host to known_hosts
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
@@ -117,14 +142,11 @@ jobs:
|
|||||||
rsync -az --delete \
|
rsync -az --delete \
|
||||||
-e "sshpass -e ssh -p ${DEPLOY_PORT:-22}" \
|
-e "sshpass -e ssh -p ${DEPLOY_PORT:-22}" \
|
||||||
--exclude='.env' \
|
--exclude='.env' \
|
||||||
--exclude='.git' \
|
|
||||||
--exclude='storage/logs/*' \
|
--exclude='storage/logs/*' \
|
||||||
--exclude='storage/framework/cache/*' \
|
--exclude='storage/framework/cache/*' \
|
||||||
--exclude='storage/framework/sessions/*' \
|
--exclude='storage/framework/sessions/*' \
|
||||||
--exclude='storage/framework/views/*' \
|
--exclude='storage/framework/views/*' \
|
||||||
--exclude='vendor' \
|
release/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
|
||||||
--exclude='node_modules' \
|
|
||||||
. "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
|
|
||||||
|
|
||||||
- name: Create .env on server from secret
|
- name: Create .env on server from secret
|
||||||
env:
|
env:
|
||||||
@@ -148,7 +170,7 @@ jobs:
|
|||||||
|
|
||||||
printf '%s' "$DEPLOY_ENV_FILE" | sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p \"${DEPLOY_PATH}\" && cat > \"${DEPLOY_PATH}/.env\" && chmod 600 \"${DEPLOY_PATH}/.env\""
|
printf '%s' "$DEPLOY_ENV_FILE" | sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p \"${DEPLOY_PATH}\" && cat > \"${DEPLOY_PATH}/.env\" && chmod 600 \"${DEPLOY_PATH}/.env\""
|
||||||
|
|
||||||
- name: Install dependencies and build on server
|
- name: Run post-deploy Laravel commands
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
||||||
@@ -162,7 +184,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "cd ${DEPLOY_PATH} && composer install --no-dev --optimize-autoloader && npm ci && npm run build && php artisan optimize:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache"
|
sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "cd ${DEPLOY_PATH} && php artisan optimize:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache"
|
||||||
|
|
||||||
# Required repository secrets:
|
# Required repository secrets:
|
||||||
# - DEPLOY_HOST: Server hostname or IP.
|
# - DEPLOY_HOST: Server hostname or IP.
|
||||||
|
|||||||
Reference in New Issue
Block a user