Skip to content

Commit

Permalink
chore: CodeDeploy to EC2
Browse files Browse the repository at this point in the history
  • Loading branch information
siepra committed Mar 20, 2024
1 parent 609feb4 commit a5c3ee1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy to EC2

on:
release:
types:
[prereleased, released]

env:
AWS_REGION: us-east-1


jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
- 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: ${{ env.AWS_REGION }}
- run: |
echo "Deploying branch ${{ env.GITHUB_REF }} to ${{ github.event.inputs.environment }}"
commit_hash=`git rev-parse HEAD`
aws deploy create-deployment --application-name ${{ secrets.CODE_DEPLOY_APPLICATION_NAME }} --deployment-group-name ${{ secrets.CODE_DEPLOY_GROUP_NAME }} --github-location repository=$GITHUB_REPOSITORY,commitId=$commit_hash --ignore-application-stop-failures
14 changes: 14 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.0
os: linux
files:
- source: /
destination: /qss
hooks:
AfterInstall:
- location: aws/scripts/after-install.sh
timeout: 300
runas: root
ApplicationStart:
- location: aws/scripts/application-start.sh
timeout: 300
runas: root
1 change: 1 addition & 0 deletions aws/scripts/after-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm i
1 change: 1 addition & 0 deletions aws/scripts/application-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run start

0 comments on commit a5c3ee1

Please sign in to comment.