temp #635
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: Testing & Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-deploy-beth-environment: | |
runs-on: ubuntu-22.04 | |
environment: | |
name: beth-production | |
url: https://www.bethanyfrankisportfolio.com | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: zip, sqlite3 | |
coverage: none | |
- name: Install composer dependencies | |
run: composer install --no-cache --no-ansi --no-interaction --no-progress | |
- name: Copy production .env | |
run: php -r "file_exists('.env') || copy('.env.beth.production', '.env');" | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Install node dependencies | |
run: npm ci | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build frontend | |
run: | | |
npm run build | |
- name: Echo information to .env | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "DB_HOST=${{ secrets.DB_HOST}}" >> .env | |
echo "DB_DATABASE=${{ secrets.DB_DATABASE}}" >> .env | |
echo "DB_USERNAME=${{ secrets.DB_USERNAME}}" >> .env | |
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD}}" >> .env | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID}}" >> .env | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY}}" >> .env | |
echo "SLACK_BOT_USER_OAUTH_TOKEN=${{ secrets.SLACK_BOT_USER_OAUTH_TOKEN }}" >> .env | |
echo "SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }}" >> .env | |
- name: Build ZIP Deployment Package | |
if: github.ref == 'refs/heads/main' | |
run: zip -r deploy.zip ./ -x "node_modules/*" -x "vendor/*" -x "tests/*" | |
- name: Deploy to Beth Production EB Environment | |
if: github.ref == 'refs/heads/main' | |
uses: einaregilsson/beanstalk-deploy@v22 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }} | |
application_name: Portfolio | |
environment_name: portfolio-production | |
existing_bucket_name: elasticbeanstalk-ap-southeast-2-533267327531 | |
region: ap-southeast-2 | |
version_label: ${{ github.sha }} | |
deployment_package: deploy.zip |