Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ranjit #14

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ phases:
- echo Installing source NPM dependencies...
- npm install
- npm install unit.js
- git config --global user.email "nagadevops2016@gmail.com"
- git config --global user.name "nagadevops2016"
- cat /root/.ssh/id_rsa.pub
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha test.js

post_build:
commands:
- whoami
- pwd
- echo Build completed on `date`
- echo $last_tag_name
- echo $date
- git tag
- chmod +x tag.sh
- ./tag.sh
# Include only the files required for your application to run.
# Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages
# used only for building and testing.
Expand Down
25 changes: 25 additions & 0 deletions tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Create a new tag with date and incrementing version of a git repo

# Get the current version of the repo
CURRENT_VERSION=$(git tag | sort -V | tail -n1)

# split the version into components
VERSION_NUMBERS=(${CURRENT_VERSION//./ })

# Increment the last number in the version
VERSION_NUMBERS[2]=$((${VERSION_NUMBERS[2]}+1))

# Re-create the version string
NEW_VERSION="${VERSION_NUMBERS[0]}.${VERSION_NUMBERS[1]}.${VERSION_NUMBERS[2]}"

# Get the current date
DATE=$(date +"%Y%m%d")

# Create the new tag
TAG="eemp.infra.dev$DATE.$NEW_VERSION"

# Add and push the tag
git tag $TAG
git push origin $TAG git@github.com:nagadevops2016/aws-nodejs-sample-codebuild.git
##