Skip to content

Update base image in production Dockerfile from lostlink/vapor to lar… #102

Update base image in production Dockerfile from lostlink/vapor to lar…

Update base image in production Dockerfile from lostlink/vapor to lar… #102

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
- develop
workflow_dispatch:
jobs:
test:
name: Test
uses: lostlink/dotenv/.github/workflows/test.yml@main
secrets:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
deploy:
name: Deploy to Vapor
runs-on: ubuntu-latest
# needs: [ test ]
concurrency: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }} - ${{ matrix.region }}
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
env:
APP_ENV: ${{ github.ref == 'refs/heads/main' && 'production' || 'develop' }}
strategy:
fail-fast: false
matrix:
region:
- "us-east-1"
# - "us-east-2"
# - "us-west-2"
steps:
- name: Check out code
uses: actions/checkout@v4
with:
lfs: true
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ matrix.region }}
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: 6
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, gmp
coverage: none
- name: Add HTTP basic auth credentials
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
- name: Set VaporFile from Region
run: |
./vapor-switch.sh --region ${{ matrix.region }} --force
# - name: Update .env
# run: |
# echo php artisan dotenv:pull -p=${{ secrets.PROJECT_SLUG }} -t=${{ secrets.TARGET_SLUG }} -e=${{ env.APP_ENV }} > .env.${{ env.APP_ENV }}
# ./vendor/bin/vapor env:push ${{ env.APP_ENV }} -q
# env:
# VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
- name: Retrieve .env
run: |
./vendor/bin/vapor env:pull ${{ env.APP_ENV }}
cp .env.${{ env.APP_ENV }} .env
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
# - name: Sidecar
# run: php artisan sidecar:deploy --env=${{ env.APP_ENV }} --activate
- name: Deploy code
run: ./vendor/bin/vapor deploy ${{ env.APP_ENV }} --commit="${{ github.sha }}"
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: Logs
path: ./storage/logs
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ env.APP_ENV }}
- name: Remove auth.json file
run: rm -f $GITHUB_WORKSPACE/auth.json