{"id":18563120,"url":"https://github.com/compulim/commit-publish","last_synced_at":"2025-05-15T18:12:48.253Z","repository":{"id":57204236,"uuid":"125439233","full_name":"compulim/commit-publish","owner":"compulim","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-19T22:53:39.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T05:06:36.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/compulim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-03-15T23:48:13.000Z","updated_at":"2018-07-19T22:53:40.000Z","dependencies_parsed_at":"2022-08-29T19:10:12.021Z","dependency_job_id":null,"html_url":"https://github.com/compulim/commit-publish","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compulim%2Fcommit-publish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compulim%2Fcommit-publish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compulim%2Fcommit-publish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compulim%2Fcommit-publish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compulim","download_url":"https://codeload.github.com/compulim/commit-publish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254394726,"owners_count":22063984,"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-06T22:11:51.790Z","updated_at":"2025-05-15T18:12:45.682Z","avatar_url":"https://github.com/compulim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Package template with CI/CD using Travis CI\n\n[![npm version](https://badge.fury.io/js/commit-publish-template.svg)](https://badge.fury.io/js/commit-publish-template) [![Build Status](https://travis-ci.org/compulim/commit-publish.svg?branch=master)](https://travis-ci.org/compulim/commit-publish)\n\n## Objectives\n\nWe want to use Travis CI to build and publish packages to NPM to ensure the build is consistent and tested in a clean environment.\n\nWe want to use NPM [dist-tags](https://docs.npmjs.com/getting-started/using-tags) to encourage user to try out latest build, by simply running `npm install your-package@master`.\n\nWe want to make sure every official packages, not pre-releases, will be tagged by GitHub Release.\n\nWe depends on [`version-from-git`](https://npmjs.com/package/version-from-git) to bump package version based on Git branch/commit, like `1.0.0-master.1a2b3c4`.\n\n## Setup your package\n\nYou will need to setup:\n\n* [Your project](#setup-your-project)\n* [Travis CI](#enable-travis-ci)\n* [NPM token for publish](#update-npm-token)\n* [GitHub token for release](#update-github-token)\n\n### Setup your project\n\nDownload [`.travis.yml`](blob/master/.travis.yml) and save under your package.\n\n```\ncurl -o .travis.yml https://raw.githubusercontent.com/compulim/commit-publish/master/.travis.yml\n```\n\n### Enable Travis CI\n\nEnable Travis CI first so we can use the per-project public key to encrypt secrets.\n\n1. Visit your [Profile page](https://travis-ci.org/profile) on Travis\n2. Click \"Sync account\"\n3. Enable Travis CI for your project\n\n\u003e You may want to \"Limit concurrent jobs\" to 1 if you tend to push tags and commits quickly\n\n### Update NPM token\n\nNPM token is required to run `npm publish`.\n\n1. Run `npm token create` and write down the GUID token\n2. Encrypt the token thru this [webpage](https://travis-encrypt.github.io/)\n3. Modify `.travis.yml`\n   * Set `deploy.npm.api_key.secure` to the encrypted token\n   * Set `deploy.npm.email` to your NPM email\n\n### Update GitHub token\n\nGitHub token is required to create release automatically.\n\n1. On GitHub, create a personal access token with access to `repo/public_repo` scope\n2. Encrypt the token thru this [webpage](https://travis-encrypt.github.io/)\n3. Modify `.travis.yml`\n   * Set `deploy.releases.api_key.secure` to the encrypted token\n   * Set `deploy.releases.email` to your NPM email\n\n## Deployment\n\nNow, you can do two types of deployment:\n\n* [Deploy as pre-release](#deploy-as-pre-release)\n* [Deploy as production release](#deploy-as-production-release)\n\n### Deploy as pre-release\n\nWhen your GitHub `master` branch receive a commit, either by accepting pull requests or pushing to master. Travis CI will build and publish to NPM automatically.\n\n### Deploy as production release\n\nWe follow NPM standard steps to deploy a release.\n\n1. Run `npm version 1.0.0`\n2. Run `git push origin v1.0.0`, this only push to a new tag and not `master` branch\n\nYou should see the following:\n\n```\n$ npm version 1.0.0\nv1.0.0\n\n$ git push origin v1.0.0\nCounting objects: 5, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (5/5), done.\nWriting objects: 100% (5/5), 494 bytes | 247.00 KiB/s, done.\nTotal 5 (delta 3), reused 0 (delta 0)\nremote: Resolving deltas: 100% (3/3), completed with 3 local objects.\nTo https://github.com/compulim/your-package.git\n * [new tag]         v1.0.0 -\u003e v1.0.0\n```\n\n#### Release verification\n\n1. Visit [GitHub Releases](../../releases) should show `1.0.0` release with binaries attached\n2. Run `npm show your-package versions` should list `1.0.0`\n3. Run `npm dist-tags ls your-package` should tag `1.0.0` as `latest`\n\n#### Post-publish steps\n\nAssume you published production release `1.0.0`, you may want to prepare for the next pre-release immediately. Otherwise, your next push to `master` branch could be tagged incorrectly as `1.0.0-master.*`, instead of `1.0.1-master.*`.\n\n1. Run `npm version prepatch`\n2. Run `git push`\n\n```\n$ npm version prepatch\nv1.0.1-0\n\n$ git push\nTotal 0 (delta 0), reused 0 (delta 0)\nTo https://github.com/compulim/your-package.git\n   a9c47a7..d053fa6  master -\u003e master\n```\n\n# Addendum\n\n## Encrypting token using Docker\n\nYou can also use Docker image [`caktux/travis-cli`](https://hub.docker.com/r/caktux/travis-cli/) to do the encryption. Run `docker run --rm caktux/travis-cli encrypt 12345678-1234-5678-abcd-12345678abcd -r your-org/your-repo`\n\n# Contributions\n\nLike us? [Star](https://github.com/compulim/commit-publish/stargazers) us.\n\nWant to make it better? [File](https://github.com/compulim/commit-publish/issues) us an issue.\n\nDon't like something you see? [Submit](https://github.com/compulim/commit-publish/pulls) a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompulim%2Fcommit-publish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompulim%2Fcommit-publish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompulim%2Fcommit-publish/lists"}