-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 1.94 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Release
on:
push:
branches:
- main
env:
PROJECT : "maurobaptista.com"
STAGE : "production"
AWS_REGION : "us-east-1"
PHP_VERSION : "8.1"
COMPOSER_VERSION : "v2"
permissions:
id-token: write
contents: read
jobs:
deploy-labda:
name: Deploy Lambda
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ env.PROJECT }}-github-action-role
aws-region: ${{ env.AWS_REGION }}
role-duration-seconds: 900
role-session-name: Lambda
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:${{ env.COMPOSER_VERSION }}
coverage: none
- name: Get File from Parameter Store
run: ./deploy/write_to_file.php "$(aws --region ${{ env.AWS_REGION }} ssm get-parameter --with-decryption --name /${{ env.PROJECT }}/${{ env.STAGE }}/env)" .env
- name: Npm install & build
run: |
npm install
npm run build
- name: Copy assets to CDN
run: |
aws s3 cp ./public/build s3://${{ env.PROJECT }}/cdn/build --recursive --acl public-read
- name: Install Serverlesss
run: |
npm install [email protected] -g
npm install [email protected] -g
npm install [email protected] -g
- name: Composer install
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
- name: Prepare Laravel
run: |
php artisan config:clear
php artisan route:clear
php artisan view:clear
touch ./storage/logs/laravel.log
- name: Deploy Lambda
run: serverless deploy --stage ${{ env.STAGE }}