Fix: Homepage snapshot added #11
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: Blog API Laravel Deploy | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
deploy-main: | |
name: Deploy Blog API to main | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
- name: Install Render CLI | |
run: | | |
curl -O https://render.com/download/render_linux | |
chmod +x render_linux | |
sudo mv render_linux /usr/local/bin/render | |
- name: Create env for App | |
run: | | |
cat > .env << EOF | |
APP_NAME=Laravel | |
APP_ENV=local | |
APP_KEY= | |
APP_DEBUG=true | |
APP_URL= | |
LOG_CHANNEL=stack | |
LOG_DEPRECATIONS_CHANNEL=null | |
LOG_LEVEL=debug | |
DB_CONNECTION=mysql | |
DB_HOST=${{ secrets.DB_HOST }} | |
DB_PORT=${{ secrets.DB_PORT }} | |
DB_DATABASE=${{ secrets.DB_NAME }} | |
DB_USERNAME=${{ secrets.DB_USER }} | |
DB_PASSWORD=${{ secrets.DB_PASSWORD }} | |
BROADCAST_DRIVER=log | |
CACHE_DRIVER=file | |
FILESYSTEM_DISK=local | |
QUEUE_CONNECTION=sync | |
SESSION_DRIVER=file | |
SESSION_LIFETIME=120 | |
EOF | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Build and push Docker image | |
run: | | |
cd backend && docker build -t steph-news-aggregator . | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/steph-news-aggregator | |
- name: Install dependencies on app | |
run: | | |
cd backend && docker-compose up -d \ | |
-e DB_DATABASE=${{ secrets.DB_NAME }} \ | |
-e DB_USERNAME=${{ secrets.DB_USER }} \ | |
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \ | |
-e DB_PORT=${{ secrets.DB_PORT }} \ | |
-e DB_HOST=${{ secrets.DB_HOST }} \ | |
- name: Deploy to Render | |
run: | | |
render deploy -- --useDockerfile |