Skip to content

Instantly share code, notes, and snippets.

@yogeshwar-chaudhari-20
Last active November 26, 2022 19:40
Show Gist options
  • Save yogeshwar-chaudhari-20/9d8be099efe2f8a2cd88051210b6e644 to your computer and use it in GitHub Desktop.
Save yogeshwar-chaudhari-20/9d8be099efe2f8a2cd88051210b6e644 to your computer and use it in GitHub Desktop.
GitHub Actions Workflow Script to deploy to AWS EBS
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: elastic.beanstalk.dev CD
on:
push:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# cache: 'npm'
- name: Installing NPM
run: npm install
- run: npm ci
# - run: npm run build --if-present To be done once you have a test suite ready
- name: Generate deployment package
run: zip -r deploy.zip * -x "**node_modules**"
- name: Get timestamp
uses: gerred/actions/current-time@master
id: current-time
- name: Run string replace
uses: frabert/replace-string-action@master
id: format-time
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: '-'
flags: 'g'
- name: Beanstalk Deploy my app
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{secrets.AWS_PROD_ACCESS_KEY}}
aws_secret_key: ${{secrets.AWS_PROD_SECRET_KEY}}
application_name: vita-elastic-beanstalk-trial
environment_name: Vitaelasticbeanstalktrial-env
region: ap-southeast-2
version_label: "app-version-${{ steps.format-time.outputs.replaced }}" #Using timestamp for the versions
deployment_package: deploy.zip
- name: Deployed successfully!
run: echo App deployed to ELB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment