Skip to content

wip and update some permissions in aws #13

wip and update some permissions in aws

wip and update some permissions in aws #13

Workflow file for this run

name: Deploy
on: [ push ]
jobs:
tests-and-deploy-steps:
runs-on: ubuntu-20.04
env:
DB_DATABASE: testing
DB_USER: root
DB_PASSWORD: root
steps:
- uses: actions/checkout@v3
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: zip, sqlite3
coverage: none
- name: Check composer compatability
run: composer check-platform-reqs
- name: Install composer dependencies
run: composer install --no-cache --no-ansi --no-interaction --no-progress
- name: Install node dependencies
run: npm ci
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Format code
run: |
echo "running eslint and prettier..."
npm run format
echo "running php-cs-fixer..."
vendor/bin/php-cs-fixer fix
- name: Copy .env
run: php -r "file_exists('.env') || copy('.deployment.env.example', '.env');"
- name: Generate key
run: php artisan key:generate
- name: Build frontend
run: |
npm run build
- name: Execute tests
env:
DB_USERNAME: root
DB_PASSWORD: root
run: php artisan test
- name: Echo URL to .env
if: github.ref == 'refs/heads/main'
run: |
echo "APP_URL=http://habittracker-uc-1.eba-ayudv8jf.ap-southeast-2.elasticbeanstalk.com" >> .env
echo "DB_HOST=${{ secrets.DB_HOST}}" >> .env
echo "DB_PORT=3306" >> .env
echo "DB_DATABASE=${{ secrets.DB_DATABASE}}" >> .env
echo "DB_USERNAME=${{ secrets.DB_USERNAME}}" >> .env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD}}" >> .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 Elastic Beanstalk
if: github.ref == 'refs/heads/main'
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
application_name: "Habit Tracker"
environment_name: HabitTracker-UC-1
existing_bucket_name: elasticbeanstalk-ap-southeast-2-290427685328
region: ap-southeast-2
version_label: ${{ github.sha }}
deployment_package: deploy.zip