Skip to content

Commit

Permalink
build artifact in codebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
fideloper committed Sep 5, 2021
1 parent 590091f commit 8fb143d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -11,3 +11,7 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.DS_Store
public/css
public/js
public/mix-manifest.json
2 changes: 2 additions & 0 deletions builds/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore
10 changes: 2 additions & 8 deletions buildspec.yml
Expand Up @@ -17,13 +17,7 @@ phases:
- php artisan test
build:
commands:
- echo "todo -> Build an artifact"
- ./scripts/build.sh staging
post_build:
commands:
- echo "todo -> Kick off a deployment"
artifacts:
files:
- "**/*"
name: $CODEBUILD_RESOLVED_SOURCE_VERSION
#discard-paths: no
#base-directory: location
- echo "todo -> Kick off a deployment"
16 changes: 16 additions & 0 deletions scripts/build.sh
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# Production assets/dependencies
npm install
npm run production

# TODO: Generate a .env file

# Create our build artifact
git archive -o builds/cloudcasts.zip --worktree-attributes HEAD
zip -qur builds/cloudcasts.zip vendor
zip -qur builds/cloudcasts.zip public
zip -qur builds/cloudcasts.zip .env

# Upload artifact to s3
aws s3 cp builds/cloudcasts.zip s3://cloudcasts-$1-artifacts/$CODEBUILD_RESOLVED_SOURCE_VERSION.zip

0 comments on commit 8fb143d

Please sign in to comment.