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

Release 3.0.1 #35

Merged
merged 28 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Fix, refactor; temporary change to test publish-latest.sh
  • Loading branch information
Julien Heller committed Dec 19, 2018
commit 7f830822e30dd17cecbe5cea7ecebf7528e3c107
21 changes: 16 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,34 @@ before_install:
- npm install -g typescript
stages:
- test
- name: deploy
- name: publish-edge
if: (NOT type IN (pull_request)) AND (branch = develop)
- name: publish-latest
if: (tag =~ /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/) AND (branch = automate-publish)
jobs:
include:
- stage: test
name: "Lint and Test"
script:
- npm run lint
- npm run test
- stage: deploy
name: "Deploy to NPM"
- stage: publish-edge
name: "Publish @edge to NPM"
script:
- npm run build
deploy:
provider: script
skip_cleanup: true
script:
- ./scripts/publish.sh
script: ./scripts/publish-edge.sh
on:
branch: develop
- stage: publish-edge
name: "Publish @latest to NPM"
script:
- npm run build
deploy:
provider: script
skip_cleanup: true
script: ./scripts/publish-latest.sh
on:
branch: automate-publish
38 changes: 6 additions & 32 deletions scripts/publish.sh → scripts/functions.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

setup_git() {
echo "Setting up git"

# Set the user name and email to match the API token holder
# This will make sure the git commits will have the correct photo
# and the user gets the credit for a checkin
Expand All @@ -15,17 +15,11 @@ setup_git() {
echo "https://${GITHUB_API_KEY}:@github.com" > .git/credentials
}

test_master() {
if ! [ "$TRAVIS_BRANCH" = "automate-publish" -a -n "$TRAVIS_TAG" ]; then
echo "not master or tag!"
return 1
fi
if ! echo "$TRAVIS_TAG" | grep "^v[0-9]\.[0-9]\.[0-9]" >/dev/null; then
echo "tag not a version!"
return 1
fi
check_version() {
if ! [ "$TRAVIS_TAG" = "$(npm run version --silent)" ]; then
echo "tag not current version!"
echo "Tag does not match the version in package.json!"
echo "tag: $TRAVIS_TAG"
echo "version: $(npm run version --silent)"
return 1
fi
return 0
Expand Down Expand Up @@ -55,23 +49,3 @@ publish_latest() {

npm publish
}

echo "Running on branch ${TRAVIS_BRANCH}":

echo "Setting up git"
setup_git

# Make sure that the workspace is clean
# It could be "dirty" if
# 1. package-lock.json is not aligned with package.json
# 2. npm install is run
git checkout -- .

# Echo the status to the log so that we can see it is OK
git status

if test_master; then
publish_latest
else
publish_edge
fi
16 changes: 16 additions & 0 deletions scripts/publish-edge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
. functions.sh

echo "Running on branch ${TRAVIS_BRANCH}":

setup_git

# Make sure that the workspace is clean
# It could be "dirty" if
# 1. package-lock.json is not aligned with package.json
# 2. npm install is run
git checkout -- .

# Echo the status to the log so that we can see it is OK
git status

publish_edge
18 changes: 18 additions & 0 deletions scripts/publish-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
. functions.sh

echo "Running on branch ${TRAVIS_BRANCH}":

setup_git

# Make sure that the workspace is clean
# It could be "dirty" if
# 1. package-lock.json is not aligned with package.json
# 2. npm install is run
git checkout -- .

# Echo the status to the log so that we can see it is OK
git status

if check_version; then
publish_latest
fi