Skip to content

Commit

Permalink
Adding a CI/CD process using Cloud Build
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed May 19, 2019
1 parent 10995e5 commit 1978ae9
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 32 deletions.
27 changes: 27 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See go/emberfire-releasing for details on the EmberFire release process.
# If you need to trigger a release manually, be sure to use substitutions like so:
# @canary `gcloud builds submit --substitutions=SHORT_SHA="9b0a0b0"`
# @next `gcloud builds submit --substitutions=TAG_NAME="v1.2.3-rc.1"`
# @latest `gcloud builds submit --substitutions=TAG_NAME="v1.2.3"`
steps:
- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'bash'
args: ["./tools/build.sh"]
env:
- 'TAG_NAME=$TAG_NAME'
- 'SHORT_SHA=$SHORT_SHA'

- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'bash'
args: ["./tools/test.sh"]

- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'bash'
env: ['TAG_NAME=$TAG_NAME']
args: ["./tools/publish.sh"]
secretEnv: ['NPM_TOKEN']

secrets:
- kmsKeyName: projects/emberfire/locations/global/keyRings/cloud-build/cryptoKeys/cloud-build
secretEnv:
NPM_TOKEN: CiQAxlQk+PxG1u0O1jMNoRKrxzNe3cSVlQy3gaqsjD41F2m4OVsSTQDyeLEmlpwbxLfuaD0/PrvQ/BYQcwosux7TsMiIMX6PAAD61VfBV6teM5fkIgmWG7rPdRmFvzavH0j2excXsS1k8KR4lLh6+gsT3JUk
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emberfire",
"version": "3.0.0-rc.1",
"name": "emberfire-exp",
"version": "3.0.0",
"description": "The officially supported adapter for using Firebase with Ember",
"keywords": [
"ember-addon",
Expand Down
12 changes: 12 additions & 0 deletions tools/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO remove when no longer publishing to emberfire-exp
export EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH=true

if test $TAG_NAME; then
npm version $(echo $TAG_NAME | sed 's/^v\(.*\)$/\1/')
else
npm version $(npm version | head -n 1 | sed "s/^.*: '\([^']*\).*/\1/")-canary.$SHORT_SHA
fi

npm install
npm run build
npm run reference
16 changes: 16 additions & 0 deletions tools/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc

LATEST_TEST="^v[^-]*$"

if test $TAG_NAME; then
if [[ ! $TAG_NAME =~ $LATEST_TEST ]]; then
npm publish . --tag next
else
npm publish .
fi
else
npm publish . --tag canary
fi

# TODO put this in a shell trap
rm -f .npmrc
11 changes: 11 additions & 0 deletions tools/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# TODO remove when no longer publishing to emberfire-exp
export EMBER_CLI_IGNORE_ADDON_NAME_MISMATCH=true

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list

apt-get -y update
apt-get -y install google-chrome-stable

# Already built, don't need to do that again
npx ember test

0 comments on commit 1978ae9

Please sign in to comment.