5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-07 18:56:56 +00:00

Merge pull request #13 from cycjimmy/use-the-latest-version-of-semantic-release-by-default

perf(*): use the latest version of semantic-release by default
This commit is contained in:
Geoffrey.C 2020-01-13 17:47:46 +08:00 committed by GitHub
commit 840d793121
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 5492 deletions

View file

@ -17,7 +17,7 @@ jobs:
uses: ./ uses: ./
with: with:
extra_plugins: | extra_plugins: |
@semantic-release/git@7.0.18 @semantic-release/git
@semantic-release/changelog @semantic-release/changelog
dry_run: true dry_run: true
env: env:

View file

@ -21,9 +21,10 @@ jobs:
id: semantic id: semantic
with: with:
branch: master branch: master
semantic_version: 15
extra_plugins: | extra_plugins: |
@semantic-release/git@7.0.18 @semantic-release/git@7
@semantic-release/changelog @semantic-release/changelog@3
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -20,9 +20,10 @@ jobs:
uses: cycjimmy/semantic-release-action@v2 uses: cycjimmy/semantic-release-action@v2
id: semantic id: semantic
with: with:
semantic_version: 15
extra_plugins: | extra_plugins: |
@semantic-release/git@7.0.18 @semantic-release/git@7
@semantic-release/changelog @semantic-release/changelog@3
dry_run: true dry_run: true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -18,7 +18,7 @@ GitHub Action for [Semantic Release](https://github.com/semantic-release/semanti
#### Step3: Add a [Workflow File](https://help.github.com/en/articles/workflow-syntax-for-github-actions) to your repository to create custom automated processes. #### Step3: Add a [Workflow File](https://help.github.com/en/articles/workflow-syntax-for-github-actions) to your repository to create custom automated processes.
* inputs: * inputs:
* `branch`: [Optional] The branch on which releases should happen. It will override the branch attribute in your configuration file. If the attribute is not configured on both sides, the default is master. * `branch`: [Optional] The branch on which releases should happen. It will override the branch attribute in your configuration file. If the attribute is not configured on both sides, the default is master.
* `semantic_version`: [Optional] Specify specifying version range for semantic-release. If no version range is specified, semantic-release@^15 will be used by default. * `semantic_version`: [Optional] Specify specifying version range for semantic-release. If no version range is specified, latest version will be used by default.
* `extra_plugins`: [Optional] Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. * `extra_plugins`: [Optional] Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer.
* `dry_run`: [Optional] Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file. * `dry_run`: [Optional] Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file.
* outputs: * outputs:
@ -35,25 +35,9 @@ GitHub Action for [Semantic Release](https://github.com/semantic-release/semanti
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v2 uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
#### Using `branch` and `semantic_version`
```yaml
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
branch: master
semantic_version: 15.13.28
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@ -67,9 +51,9 @@ _github-action_
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v2 uses: cycjimmy/semantic-release-action@v3
with: with:
# You can specify specifying version range for the extra plugins if you prefer. # You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: | extra_plugins: |
@ -91,17 +75,34 @@ _release-config_
] ]
``` ```
#### Manually Specify a Version of Semantic-release and Its Plugins
It is recommended to manually specify a version of semantic-release and its plugins to prevent errors caused during the official semantic-release upgrade.
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 15.14.0
extra_plugins: |
@semantic-release/git@7.0.18
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
#### Using Output Variables #### Using Output Variables
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v2 uses: cycjimmy/semantic-release-action@v3
id: semantic # Need an `id` for output variables id: semantic # Need an `id` for output variables
with:
branch: master
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

5447
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,6 @@
}, },
"homepage": "https://github.com/cycjimmy/semantic-release-action#readme", "homepage": "https://github.com/cycjimmy/semantic-release-action#readme",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.0", "@actions/core": "^1.2.0"
"semantic-release": "^15.14.0"
} }
} }

View file

@ -9,17 +9,13 @@ const inputs = require('./inputs.json');
*/ */
module.exports = async () => { module.exports = async () => {
const semantic_version = core.getInput(inputs.semantic_version); const semantic_version = core.getInput(inputs.semantic_version);
const versionSuffix = semantic_version
? `@${semantic_version}`
: '';
if (!semantic_version) { const {stdout, stderr} = await exec(`npm install semantic-release${versionSuffix}`, {
return Promise.resolve();
}
const {stdout, stderr} = await exec(`npm install semantic-release@${semantic_version}`, {
cwd: path.resolve(__dirname, '..') cwd: path.resolve(__dirname, '..')
}); });
core.debug(stdout); core.debug(stdout);
core.error(stderr);
if (stderr) {
return Promise.reject(stderr);
}
}; };

View file

@ -22,8 +22,5 @@ module.exports = async () => {
cwd: path.resolve(__dirname, '..') cwd: path.resolve(__dirname, '..')
}); });
core.debug(stdout); core.debug(stdout);
core.error(stderr);
if (stderr) {
return Promise.reject(stderr);
}
}; };