5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-14 14:03:47 +00:00

Merge origin cycjimmy

This commit is contained in:
Dan Hunt 2022-10-27 12:04:11 -04:00
commit 00e96e5bcb
11 changed files with 9357 additions and 90 deletions

View file

@ -1,2 +1,2 @@
# Contributing
The repository is released under the MIT license, and follows a standard Github development process, using Github tracker for issues and merging pull requests into master.
The repository is released under the MIT license, and follows a standard Github development process, using Github tracker for issues and merging pull requests into main.

View file

@ -3,7 +3,7 @@ name: Check Pull Request
on:
pull_request:
branches:
- master
- main
jobs:
release:
@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: ./
with:
branch: master
branch: main
extra_plugins: |
@semantic-release/git
@semantic-release/changelog

View file

@ -1,12 +1,10 @@
name: Release
on:
pull_request:
branches:
- master
push:
branches:
- master
- main
- next
- next-major
- alpha
@ -18,12 +16,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: ./
id: semantic
with:
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'main',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
]
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
@ -32,9 +46,9 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup Node.js with GitHub Package Registry
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: 'cycjimmy'

View file

@ -1,17 +1,11 @@
name: Test Release
on:
push:
pull_request:
branches:
- master
- next
- next-major
- alpha
- beta
- 'feat/**'
- 'fix/**'
- 'perf/**'
- 'refactor/**'
- main
push:
schedule:
- cron: 0 2 * * 0
@ -22,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: ./
@ -33,6 +27,7 @@ jobs:
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'main',
'next',
'next-major',
{
@ -44,7 +39,6 @@ jobs:
prerelease: true
}
]
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
@ -65,7 +59,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: ./
@ -75,11 +69,11 @@ jobs:
dry_run: true
branches: |
[
'master',
'main',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
branch: master
branch: main
extra_plugins: |
@semantic-release/git@7
@semantic-release/changelog@3

View file

@ -8,9 +8,9 @@
GitHub Action for [Semantic Release][semantic-url].
## Usage
### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) in your repository.
### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/main/docs/usage/configuration.md#configuration) in your repository.
### Step2: [Add Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) in your repository for the [Semantic Release Authentication](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication) Environment Variables.
### Step2: [Add Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) in your repository for the [Semantic Release Authentication](https://github.com/semantic-release/semantic-release/blob/main/docs/usage/ci-configuration.md#authentication) Environment Variables.
### Step3: Add a [Workflow File](https://help.github.com/en/articles/workflow-syntax-for-github-actions) to your repository to create custom automated processes.
@ -18,16 +18,16 @@ GitHub Action for [Semantic Release][semantic-url].
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- 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 }}
```
**IMPORTANT**: `GITHUB_TOKEN` does not have the required permissions to operate on protected branches.
If you are using this action for protected branches, replace `GITHUB_TOKEN` with [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). If using the `@semantic-release/git` plugin for protected branches, avoid persisting credentials as part of `actions/checkout@v2` by setting the parameter `persist-credentials: false`. This credential does not have the required permission to operate on protected branches.
If you are using this action for protected branches, replace `GITHUB_TOKEN` with [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). If using the `@semantic-release/git` plugin for protected branches, avoid persisting credentials as part of `actions/checkout@v3` by setting the parameter `persist-credentials: false`. This credential does not have the required permission to operate on protected branches.
#### Private Packages
@ -44,7 +44,7 @@ then make sure that you configure this in your `package.json` file:
### Inputs
| Input Parameter | Required | Description |
|:-----------------:|:--------:|-------------|
|:-----------------:|:--------:|--------------------------------------------------------------------------------------------------------------------------|
| semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
| branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
| branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
@ -59,9 +59,9 @@ then make sure that you configure this in your `package.json` file:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 15.13.28 # It is recommended to specify specifying version range
# for semantic-release.
@ -78,9 +78,9 @@ steps:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 16
# you can set branches for semantic-release above v16.
@ -124,9 +124,9 @@ See [configuration#branches](https://semantic-release.gitbook.io/semantic-releas
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 15.13.28
# you can set branch for semantic-release older than v16.
@ -149,9 +149,9 @@ Github Action Workflow:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
# You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: |
@ -179,9 +179,9 @@ Release Config:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
dry_run: true
env:
@ -195,13 +195,15 @@ The action can be used with `extends` option to extend an existing [sharable con
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
# You can extend an existing shareable configuration.
# And you can specify version range for the shareable configuration if you prefer.
extends: |
@semantic-release/apm-config
@semantic-release/apm-config@^9.0.0
@mycompany/override-config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@ -213,9 +215,9 @@ This action run semantic release in the github provided workspace by default. Yo
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
# You can select another working directory like a subdirectory for example.
working_directory: ./code
@ -244,9 +246,9 @@ steps:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
id: semantic # Need an `id` for output variables
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -279,8 +281,8 @@ This project is released under the [MIT License][license-url].
[semantic-url]: https://github.com/semantic-release/semantic-release
[license-image]: https://img.shields.io/npm/l/@cycjimmy/semantic-release-action.svg
[license-url]: https://github.com/cycjimmy/semantic-release-action/blob/master/LICENSE
[license-url]: https://github.com/cycjimmy/semantic-release-action/blob/main/LICENSE
[changelog-url]: https://github.com/cycjimmy/semantic-release-action/blob/master/docs/CHANGELOG.md
[changelog-url]: https://github.com/cycjimmy/semantic-release-action/blob/main/docs/CHANGELOG.md
[github-packages-registry]: https://github.com/features/packages

View file

@ -52,5 +52,5 @@ outputs:
last_release_git_tag:
description: 'The Git tag associated with the last release, if there was one.'
runs:
using: 'node12'
using: 'node16'
main: 'index.js'

View file

@ -1,3 +1,29 @@
## [3.1.1](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.0...v3.1.1) (2022-08-30)
### Bug Fixes
* set last_release_version output even if no release has been published ([b1467cd](https://github.com/cycjimmy/semantic-release-action/commit/b1467cd17e70d963d7925a60266adb249ee2223d))
# [3.1.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.0.0...v3.1.0) (2022-08-05)
### Features
* handle versioned extends inputs correctly ([4a51b9f](https://github.com/cycjimmy/semantic-release-action/commit/4a51b9fada7267737750fded8b8edfb275acbbbb))
# [3.0.0](https://github.com/cycjimmy/semantic-release-action/compare/v2.7.0...v3.0.0) (2022-03-03)
### Features
* switch operating environment to node16 ([b5f16ae](https://github.com/cycjimmy/semantic-release-action/commit/b5f16ae54b21667e3af8a1bd015ec069c8237674)), closes [#92](https://github.com/cycjimmy/semantic-release-action/issues/92) [#96](https://github.com/cycjimmy/semantic-release-action/issues/96)
### BREAKING CHANGES
* switch operating environment to node16
# [2.7.0](https://github.com/cycjimmy/semantic-release-action/compare/v2.6.0...v2.7.0) (2021-12-12)

9269
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "@cycjimmy/semantic-release-action",
"version": "2.7.0",
"version": "3.1.1",
"description": "GitHub Action for Semantic Release",
"main": "index.js",
"scripts": {
@ -22,6 +22,9 @@
"homepage": "https://github.com/cycjimmy/semantic-release-action#readme",
"dependencies": {
"@actions/core": "^1.6.0",
"@cycjimmy/awesome-js-funcs": "^3.1.0"
"@cycjimmy/awesome-js-funcs": "^4.0.4",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"semantic-release": "^19.0.5"
}
}

View file

@ -1,5 +1,5 @@
const core = require('@actions/core');
const stringToJson = require('@cycjimmy/awesome-js-funcs/cjs/typeConversion/stringToJson').default;
const stringToJson = require('@cycjimmy/awesome-js-funcs/cjs/typeConversion/stringToJson.cjs').default;
const inputs = require('./inputs.json');
/**
@ -68,7 +68,11 @@ exports.handleExtends = () => {
const extend = core.getInput(inputs.extends);
if (extend) {
return { extends: extend };
const extendModuleNames = extend.split(/\r?\n/)
.map((name) => name.replace(/(?<!^)@.+/, ''))
return {
extends: extendModuleNames
};
} else {
return {};
}

View file

@ -14,6 +14,11 @@ module.exports = async (result) => {
const {lastRelease, commits, nextRelease, releases} = result;
if (lastRelease.version) {
core.debug(`The last release was "${lastRelease.version}".`);
core.setOutput(outputs.last_release_version, lastRelease.version)
}
if (!nextRelease) {
core.debug('No release published.');
return Promise.resolve();
@ -21,10 +26,6 @@ module.exports = async (result) => {
core.debug(`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`);
if (lastRelease.version) {
core.debug(`The last release was "${lastRelease.version}".`);
}
for (const release of releases) {
core.debug(`The release was published with plugin "${release.pluginName}".`);
}