|
| 1 | +version: 0.2 |
| 2 | + |
| 3 | +phases: |
| 4 | + install: |
| 5 | + runtime-versions: |
| 6 | + golang: 1.13 |
| 7 | + nodejs: 10 |
| 8 | + commands: |
| 9 | + - npm install -g standard-version@^7.0.0 |
| 10 | + - git config user.name "Release Automation" |
| 11 | + - git config user.email $COMMIT_EMAIL_ADDRESS |
| 12 | + |
| 13 | + build: |
| 14 | + commands: |
| 15 | + # Prevent generating a new release if there are no new commits |
| 16 | + - export CURRENT_VERSION=`cat VERSION` |
| 17 | + - export COMMITS_TO_RELEASE=`git log --pretty=oneline v$CURRENT_VERSION..HEAD | wc -l` |
| 18 | + - |- |
| 19 | + if [ $COMMITS_TO_RELEASE -eq 0 ] |
| 20 | + then |
| 21 | + echo No changes to release! |
| 22 | + echo Current release: $CURRENT_VERSION |
| 23 | + exit 1 |
| 24 | + fi |
| 25 | +
|
| 26 | + # Generate a new version number, changelog entry, and version tag, based on conventional commits since the last release |
| 27 | + - standard-version |
| 28 | + |
| 29 | + # Print information about the release for review. Prevent major version bumps (these warrant extra scrutiny) |
| 30 | + - export NEW_VERSION=`cat VERSION` |
| 31 | + - export GIT_COMMIT_ID=`git rev-parse HEAD` |
| 32 | + - echo "Commit ID to release: $GIT_COMMIT_ID" |
| 33 | + - |- |
| 34 | + if echo "$NEW_VERSION" | grep -q "^1\." |
| 35 | + then |
| 36 | + echo New version: v$NEW_VERSION |
| 37 | + echo Previous version: v$CURRENT_VERSION |
| 38 | + echo Changes to release: |
| 39 | + git log --pretty=oneline v$CURRENT_VERSION..v$NEW_VERSION |
| 40 | + else |
| 41 | + echo Uh oh, new major version! v$NEW_VERSION |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | +
|
| 45 | + # Build release binaries |
| 46 | + - make stage-release-binaries |
| 47 | + - echo "Built artifacts:" |
| 48 | + - ls -lah ./bin/release-$NEW_VERSION |
| 49 | + - ./bin/release-$NEW_VERSION/linux-amd64-img2lambda --version |
| 50 | + |
| 51 | + # Generate release manifest |
| 52 | + - export MANIFESTFILE="$GIT_COMMIT_ID.manifest" |
| 53 | + - echo bin/release-$NEW_VERSION/linux-amd64-img2lambda >> $MANIFESTFILE |
| 54 | + - echo bin/release-$NEW_VERSION/darwin-amd64-img2lambda >> $MANIFESTFILE |
| 55 | + - echo bin/release-$NEW_VERSION/windows-amd64-img2lambda.exe >> $MANIFESTFILE |
| 56 | + |
| 57 | +artifacts: |
| 58 | + files: |
| 59 | + - '**/*' |
0 commit comments