Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6b10766a7 | ||
|
|
b54b20d412 | ||
|
|
88fe81915b | ||
|
|
559c152647 | ||
|
|
31e78767d9 | ||
|
|
8c0490d057 |
@@ -101,7 +101,7 @@ In order to use **semantic-release** you need:
|
||||
- To host your code in a [Git repository](https://git-scm.com)
|
||||
- Use a Continuous Integration service that allows you to [securely set up credentials](docs/usage/ci-configuration.md#authentication)
|
||||
- Git CLI version [2.7.1 or higher](docs/support/FAQ.md#why-does-semantic-release-require-git-version--271) installed in your Continuous Integration environment
|
||||
- [Node.js](https://nodejs.org) version [8.16.0 or higher](docs/support/FAQ.md#why-does-semantic-release-require-node-version--816) installed in your Continuous Integration environment
|
||||
- [Node.js](https://nodejs.org) version [10.13 or higher](docs/support/FAQ.md#why-does-semantic-release-require-node-version--1013) installed in your Continuous Integration environment
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
- `verifyConditions`: Verify the presence of the authentication (set via environment variables)
|
||||
- `prepare`: Write the correct version to the `manifest.json` and creates a zip file of the whole dist folder
|
||||
- `publish`: Uploads the generated zip file to the webstore, and publish the item
|
||||
- [semantic-release-firefox](https://github.com/felixfbecker/semantic-release-firefox)
|
||||
- `verifyConditions`: Verify the presence of the authentication (set via environment variables)
|
||||
- `prepare`: Write the correct version to the `manifest.json`, creates a `xpi` file of the dist folder and a zip of the sources
|
||||
- `publish`: Submit the generated archives to the webstore for review, and publish the item including release notes
|
||||
- [semantic-release-firefox-add-on](https://github.com/tophat/semantic-release-firefox-add-on)
|
||||
- `verifyConditions`: Verify that all required options are present and authentication is set via environment variables
|
||||
- `prepare`: Write the correct version to the `manifest.json`
|
||||
- `publish`: Creates an unsigned `.xpi` file, and submits it to the Mozilla Add On store for signing. Once the package is signed, downloads the signed `.xpi` to a local directory
|
||||
- [semantic-release-gerrit](https://github.com/pascalMN/semantic-release-gerrit)
|
||||
- `generateNotes`: Generate release notes with Gerrit reviews URL
|
||||
- [semantic-release-expo](https://github.com/bycedric/semantic-release-expo)
|
||||
|
||||
@@ -169,7 +169,7 @@ The Git history of the repository is now:
|
||||
|
||||
We can now start to work on a new future major release, version `4.0.0`, on the `@beta` distribution channel.
|
||||
|
||||
To do so we fist need to update the `beta` branch with all the changes from `master` (the commits `fix: a fix`). As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
|
||||
To do so we first need to update the `beta` branch with all the changes from `master` (the commits `fix: a fix`). As `beta` and `master` branches have diverged, this merge might require to resolve conflicts.
|
||||
|
||||
We can now commit our new feature on `beta`. When pushing that commit, **semantic-release** will publish the pre-release version `3.1.0-beta.1` on the dist-tag `@beta`. That allow us to run integration tests by installing our module with `npm install example-module@beta`. Other users installing with `npm install example-module` will still receive the version `3.0.0`.
|
||||
|
||||
|
||||
@@ -92,4 +92,6 @@ jobs:
|
||||
# Use nvm to install and use the Node LTS version (nvm is installed on all Travis images)
|
||||
- nvm install lts/*
|
||||
- npx semantic-release
|
||||
on:
|
||||
all_branches: true
|
||||
```
|
||||
|
||||
+3
-3
@@ -65,8 +65,8 @@ async function getCommits(from, to, execaOpts) {
|
||||
async function getBranches(repositoryUrl, execaOpts) {
|
||||
return (await execa('git', ['ls-remote', '--heads', repositoryUrl], execaOpts)).stdout
|
||||
.split('\n')
|
||||
.map(branch => branch.match(/^.+refs\/heads\/(?<branch>.+)$/)[1])
|
||||
.filter(Boolean);
|
||||
.filter(Boolean)
|
||||
.map(branch => branch.match(/^.+refs\/heads\/(?<branch>.+)$/)[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,7 +204,7 @@ async function isGitRepo(execaOpts) {
|
||||
*/
|
||||
async function verifyAuth(repositoryUrl, branch, execaOpts) {
|
||||
try {
|
||||
await execa('git', ['push', '--dry-run', repositoryUrl, `HEAD:${branch}`], execaOpts);
|
||||
await execa('git', ['push', '--dry-run', '--no-verify', repositoryUrl, `HEAD:${branch}`], execaOpts);
|
||||
} catch (error) {
|
||||
debug(error);
|
||||
throw error;
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
gitAddNote,
|
||||
gitGetNote,
|
||||
gitFetch,
|
||||
initGit,
|
||||
} from './helpers/git-utils';
|
||||
|
||||
test('Get the last commit sha', async t => {
|
||||
@@ -182,6 +183,11 @@ test('Get all branches', async t => {
|
||||
t.deepEqual((await getBranches(repositoryUrl, {cwd})).sort(), ['master', 'second-branch', 'third-branch'].sort());
|
||||
});
|
||||
|
||||
test('Return empty array if there are no branches', async t => {
|
||||
const {cwd, repositoryUrl} = await initGit(true);
|
||||
t.deepEqual(await getBranches(repositoryUrl, {cwd}), []);
|
||||
});
|
||||
|
||||
test('Get the commit sha for a given tag', async t => {
|
||||
// Create a git repository, set the current working directory at the root of the repo
|
||||
const {cwd} = await gitRepo();
|
||||
|
||||
@@ -7,7 +7,7 @@ import getStream from 'get-stream';
|
||||
import {GIT_NOTE_REF} from '../../lib/definitions/constants';
|
||||
|
||||
/**
|
||||
* Commit message informations.
|
||||
* Commit message information.
|
||||
*
|
||||
* @typedef {Object} Commit
|
||||
* @property {String} branch The commit branch.
|
||||
@@ -15,21 +15,34 @@ import {GIT_NOTE_REF} from '../../lib/definitions/constants';
|
||||
* @property {String} message The commit message.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize git repository
|
||||
* If `withRemote` is `true`, creates a bare repository and initialize it.
|
||||
* If `withRemote` is `false`, creates a regular repository and initialize it.
|
||||
*
|
||||
* @param {Boolean} withRemote `true` to create a shallow clone of a bare repository.
|
||||
* @return {String} The path of the repository
|
||||
*/
|
||||
export async function initGit(withRemote) {
|
||||
const cwd = tempy.directory();
|
||||
|
||||
await execa('git', ['init', ...(withRemote ? ['--bare'] : [])], {cwd});
|
||||
const repositoryUrl = fileUrl(cwd);
|
||||
return {cwd, repositoryUrl};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a temporary git repository.
|
||||
* If `withRemote` is `true`, creates a bare repository, initialize it and create a shallow clone. Change the current working directory to the clone root.
|
||||
* If `withRemote` is `false`, creates a regular repository and initialize it. Change the current working directory to the repository root.
|
||||
* If `withRemote` is `true`, creates a shallow clone. Change the current working directory to the clone root.
|
||||
* If `withRemote` is `false`, just change the current working directory to the repository root.
|
||||
*
|
||||
*
|
||||
* @param {Boolean} withRemote `true` to create a shallow clone of a bare repository.
|
||||
* @param {String} [branch='master'] The branch to initialize.
|
||||
* @return {String} The path of the clone if `withRemote` is `true`, the path of the repository otherwise.
|
||||
*/
|
||||
export async function gitRepo(withRemote, branch = 'master') {
|
||||
let cwd = tempy.directory();
|
||||
|
||||
await execa('git', ['init', ...(withRemote ? ['--bare'] : [])], {cwd});
|
||||
|
||||
const repositoryUrl = fileUrl(cwd);
|
||||
let {cwd, repositoryUrl} = await initGit(withRemote);
|
||||
if (withRemote) {
|
||||
await initBareRepo(repositoryUrl, branch);
|
||||
cwd = await gitShallowClone(repositoryUrl, branch);
|
||||
|
||||
Reference in New Issue
Block a user