force scheme #2
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: [main] | |
env: | |
APP_URL: https://keyshare.andyh.app | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
extensions: mbstring, bcmath, curl, openssl, pdo, tokenizer, xml, zip | |
tools: composer | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Configure Composer auth.json | |
run: | | |
mkdir -p ~/.composer | |
echo '${{ secrets.COMPOSER_AUTH_JSON }}' > ~/.composer/auth.json | |
- name: Install dependencies | |
run: composer install --no-interaction --prefer-dist --optimize-autoloader | |
- name: NPM install and build | |
run: | | |
npm install | |
npm run build | |
- name: Log in to GHCR | |
run: echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GH_USERNAME }}" --password-stdin | |
- name: Build and push Docker image | |
run: | | |
docker build -t ghcr.io/andy3471/keyshare:latest -f ./docker/production/Dockerfile . | |
docker push ghcr.io/andy3471/keyshare:latest | |
- name: Deploy via SSH | |
uses: appleboy/[email protected] | |
with: | |
host: andrewflix.uk | |
username: admin | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
cd /home/admin/keyshare-demo | |
docker compose pull | |
docker compose up -d | |
docker compose exec -T keyshare php artisan view:cache | |
docker compose exec -T keyshare php artisan migrate --force | |
docker compose exec -T keyshare php artisan cache:all |