{"id":18282959,"url":"https://github.com/zentered/serverless-v2.0.0","last_synced_at":"2025-04-09T05:41:19.465Z","repository":{"id":57115681,"uuid":"131953889","full_name":"zentered/serverless-v2.0.0","owner":"zentered","description":"serverless with semantic-release, automated continuous integration and automated deployments to Google Cloud Functions.","archived":false,"fork":false,"pushed_at":"2019-06-27T17:18:40.000Z","size":159,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-02T23:05:58.783Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://medium.com/heneise/serverless-v2-0-0-f5ed17fac386","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zentered.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-03T06:52:20.000Z","updated_at":"2019-06-27T17:17:15.000Z","dependencies_parsed_at":"2022-08-23T04:11:08.117Z","dependency_job_id":null,"html_url":"https://github.com/zentered/serverless-v2.0.0","commit_stats":null,"previous_names":["heneise/serverless-v2.0.0"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fserverless-v2.0.0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fserverless-v2.0.0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fserverless-v2.0.0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zentered%2Fserverless-v2.0.0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zentered","download_url":"https://codeload.github.com/zentered/serverless-v2.0.0/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987096,"owners_count":21028891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T13:06:50.288Z","updated_at":"2025-04-09T05:41:19.440Z","avatar_url":"https://github.com/zentered.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless 2.0.0\nserverless on steroids with semantic-release, automated continuous integration and automated deployments to Google Cloud Functions.\n\nThis repo is an example for an article on how to run Serverless functions with automated, continuous deployment and semantic versioning. You can find the full article here:\n\nhttps://medium.com/heneise/serverless-v2-0-0-f5ed17fac386\n\n## Steps\n\n### Repo \u0026 Code Setup\n\n```sh\nserverless create --template google-nodejs --path serverless-2\ncd serverless-2\nnpm install\nnpm install standard tap semantic-release --save-dev\nnpm install -g semantic-release-cli\nmkdir test \u0026\u0026 touch test/foobar-test.js\n```\n\nAdd `test/foobar-test.js`:\n\n```js\nconst test = require('tap').test\ntest('bogus', assert =\u003e {\n  assert.equal(1, 1, 'bogus')\n  assert.end()\n})\n```\n\nAdd `scripts` and `repository` in `package.json`:\n\n```json\n\"scripts\": {\n  \"start\": \"node index.js\",\n  \"pretest\": \"standard | snazzy\",\n  \"test\": \"tap --coverage --jobs-auto './test/*-test.js'\",\n  \"semantic-release\": \"semantic-release\"\n},\n\"repository\": {\n  \"type\": \"git\",\n  \"url\": \"https://github.com/heneise/serverless-v2.0.0.git\"\n}\n```\n\n### Google keyfile.json\n\nFollow the Google Credentials page to retrieve a `keyfile.json`: https://serverless.com/framework/docs/providers/google/guide/credentials\n\nMake sure the Service account has \"Editor\" permissions on the project.\n\nInstead of saving the `keyfile.json` to `~/.gcloud`, copy it directly into your project folder. Don't worry, `keyfile.json` is on `.gitignore` and won't be commited to the repository.\n\n### Travis CI\n\nAdd `.travis.yml`:\n\n```yaml\nlanguage: node_js\nnode_js:\n  - '10'\nnotifications:\n  email: false\ncache:\n  directories:\n    - node_modules\nenv:\n  global:\n    - NODE_ENV=test\nbefore_install:\n  - 'echo \"//registry.npmjs.org/:_authToken=\"${NPM_TOKEN} \u003e .npmrc'\n  - npm i -g npm@6\n  - npm i -g serverless\ninstall:\n  - npm ci\nscript:\n  - npm test\nafter_success:\n  - npm run semantic-release\ndeploy:\n  skip_cleanup: true\n  provider: script\n  script: serverless deploy\n  on:\n    branch: master\nbranches:\n  only:\n    - master\n    - /^greenkeeper.*$/\n```\n\nBefore setting up travis, we need to commit and push the contents to a GitHub repository:\n\n```sh\ngit init\ngit add .\ngit commit -am 'initial commit'\ngit remote add origin git remote add origin https://github.com/heneise/serverless-v2.0.0.git\ngit push -u origin master\n```\n\nHead over to [travis](https://travis-ci.com/heneise/serverless-v2.0.0) and enable the repo for testing.\n\nIn order to deploy to Google Cloud Functions, you need the `keyfile.json`. And to deploy from travis, the keyfile has to be on travis. For this part, you need the `travis-cli` to encrypt the keyfile. Head to this [Travis GitHub Repo](https://github.com/travis-ci/travis.rb) for further information on how to install this. It should be as simple as `gem install travis`. Once you have the cli, you might need to log in with `travis login`.\n\n```sh\n$ travis encrypt-file keyfile.json --add\nencrypting keyfile.json for heneise/serverless-v2.0.0\nstoring result as keyfile.json.enc\nstoring secure env variables for decryption\n\nMake sure to add keyfile.json.enc to the git repository.\nMake sure not to add keyfile.json to the git repository.\nCommit all changes to your .travis.yml.\n```\n\nKeyfile is encrypted and ready on travvis. Next step.\n\n### Semantic-Release\n\n[Documentation](https://semantic-release.gitbooks.io/semantic-release/content/)\n\nOnce travis and github are set up, let's install the tokens:\n\n```\n$ semantic-release-cli setup\n? What is your npm registry? https://registry.npmjs.org/\n? What is your npm username? hc-eng\n? What is your GitHub username? hc-eng\n? What is your GitHub two-factor authentication code? XXXXXX\n? What CI are you using? Travis CI\n? Do you want a `.travis.yml` file with semantic-release setup? No\n```\n\nThis might look different for you, if you haven't logged in with semantic-release before. We don't need the `.travis.yml` as we already configured that.\n\n### Summary\n\nThat's it. Happy version release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzentered%2Fserverless-v2.0.0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzentered%2Fserverless-v2.0.0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzentered%2Fserverless-v2.0.0/lists"}