Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	action.yml
#	package-lock.json
#	package.json
#	src/outputs.json
#	src/windUpJob.task.js
  • Loading branch information
grabus committed Aug 18, 2021
2 parents 4bb1e91 + f18184c commit 4a82c3c
Show file tree
Hide file tree
Showing 19 changed files with 369 additions and 141 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
push:
branches:
- master
- next
- next-major
- alpha
- beta

jobs:
release:
Expand All @@ -20,7 +24,6 @@ jobs:
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
Expand All @@ -29,10 +32,9 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup Node.js with GitHub Package Registry
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 12
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
node-version: 14
registry-url: 'https://npm.pkg.github.com'
scope: 'cycjimmy'

Expand All @@ -47,4 +49,3 @@ jobs:
run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

65 changes: 62 additions & 3 deletions .github/workflows/testRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,85 @@ on:
push:
branches:
- master
- next
- next-major
- alpha
- beta
- 'feat/**'
- 'fix/**'
- 'perf/**'
- 'refactor/**'

schedule:
- cron: 0 2 * * 0

jobs:
test:
name: release
test-semantic-latest:
name: test-semantic-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: ./
id: semantic
with:
dry_run: true
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
]
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Test Outputs
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
test-semantic-v15:
name: test-semantic-v15
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Semantic Release
uses: ./
id: semantic
with:
semantic_version: 15
dry_run: true
branches: |
[
'master',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
branch: master
extra_plugins: |
@semantic-release/git@7
@semantic-release/changelog@3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -38,3 +96,4 @@ jobs:
echo ${{ steps.semantic.outputs.new_release_patch_version }}
echo ${{ steps.semantic.outputs.new_release_notes }}
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,4 @@ Temporary Items
# nodejs
node_modules/
npm-debug.log
yarn-error.log

# project
.publish
dist

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 cycjimmy
Copyright (c) 2019-2020 cycjimmy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
120 changes: 77 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,38 @@
# Semantic Release Action
![][version-image]
![][workflows-badge-image]
[![Release date][release-date-image]][release-url]
[![semantic-release][semantic-image]][semantic-url]
![npm license][license-image]
[![npm license][license-image]][license-url]

[workflows-badge-image]: https://github.com/cycjimmy/semantic-release-action/workflows/Test%20Release/badge.svg
[semantic-url]: https://github.com/semantic-release/semantic-release
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[license-image]: https://img.shields.io/npm/l/@cycjimmy/semantic-release-action.svg?style=flat-square

GitHub Action for [Semantic Release](https://github.com/semantic-release/semantic-release).
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.

#### Step2: [Add Secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) 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.

#### 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:
* `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, 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.
* `dry_run`: [Optional] Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file.
* outputs:
* `new_release_published`: Whether a new release was published. `true` or `false`
* `new_release_version`: Version of the new release
* `new_release_major_version`: Major version of the new release
* `new_release_minor_version`: Minor version of the new release
* `new_release_patch_version`: Patch version of the new release
* `new_release_notes`: Release notes of the new release

### Examples

#### A simple example

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 15.13.28
# you can set branch for semantic-release older than v16.
branch: your-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
#### Passing Extra Plugins with `extra_plugins`
It will override the `branch` attribute in your configuration file. If the attribute is not configured on both sides, the default is `master`.

#### extra_plugins
> {Optional Input Parameter} Extra plugins for pre-install.

The action can be used with `extra_plugins` option to specify plugins which are not in the [default list of plugins of semantic release](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#plugins) array. For example, if you want to use `@semantic-release/git` and `@semantic-release/changelog` extra plugins, these must be added to `extra_plugins` in your actions file and `plugins` in your [release config file](https://semantic-release.gitbook.io/semantic-release/usage/configuration#configuration-file) as shown bellow:
The action can be used with `extra_plugins` option to specify plugins which are not in the [default list of plugins of semantic release](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#plugins) array.

_github-action_
For example, if you want to use `@semantic-release/git` and `@semantic-release/changelog` extra plugins, these must be added to `extra_plugins` in your actions file and `plugins` in your [release config file](https://semantic-release.gitbook.io/semantic-release/usage/configuration#configuration-file) as shown bellow:

Github Action Workflow:
```yaml
steps:
- name: Checkout
Expand All @@ -65,20 +49,19 @@ steps:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

_release-config_
Similar to parameter `semantic_version`. *It is recommended to manually specify a version of semantic-release plugins to prevent errors caused.*

Release Config:
```diff
plugins: [
.
.
+ "@semantic-release/changelog"
+ "@semantic-release/git",
]
```

#### 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.
#### dry_run
> {Optional Input Parameter} Whether to run semantic release in `dry-run` mode.<br>It will override the dryRun attribute in your configuration file.

```yaml
steps:
Expand All @@ -87,16 +70,42 @@ steps:
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 15.14.0
extra_plugins: |
@semantic-release/[email protected]
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

#### Using Output Variables
#### extends
The action can be used with `extends` option to extend an existing [sharable configuration](https://semantic-release.gitbook.io/semantic-release/usage/shareable-configurations) of semantic-release. Can be used in combination with `extra_plugins`.

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
# You can extend an existing shareable configuration.
extends: |
@semantic-release/apm-config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```

### Outputs
| Output Parameter | Description |
|:-------------------------:|---|
| new_release_published | Whether a new release was published (`true` or `false`) |
| new_release_version | Version of the new release. (e.g. `1.3.0`) |
| new_release_major_version | Major version of the new release. (e.g. `1`) |
| new_release_minor_version | Minor version of the new release. (e.g. `3`) |
| new_release_patch_version | Patch version of the new release. (e.g. `0`) |
| new_release_channel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). |
| new_release_notes | The release notes for the new release. |

#### Using Output Variables:
```yaml
steps:
- name: Checkout
Expand All @@ -110,8 +119,33 @@ steps:

- name: Do something when a new release published
if: steps.semantic.outputs.new_release_published == 'true'
run: echo ${{ steps.semantic.outputs.new_release_version }}
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
```
## [CHANGELOG](./docs/CHANGELOG.md)
## Changelog
See [CHANGELOG][changelog-url].
## License
This project is released under the [MIT License][license-url].
<!-- Links: -->
[version-image]: https://img.shields.io/github/package-json/v/cycjimmy/semantic-release-action
[workflows-badge-image]: https://github.com/cycjimmy/semantic-release-action/workflows/Test%20Release/badge.svg
[release-date-image]: https://img.shields.io/github/release-date/cycjimmy/semantic-release-action
[release-url]: https://github.com/cycjimmy/semantic-release-action/releases
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[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
[changelog-url]: https://github.com/cycjimmy/semantic-release-action/blob/master/docs/CHANGELOG.md
[github-packages-registry]: https://github.com/features/packages
20 changes: 16 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ branding:
icon: 'package'
color: 'orange'
inputs:
branch:
description: '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:
description: 'Specify specifying version range for semantic-release. If no version range is specified, semantic-release@^15 will be used by default.'
required: false
description: 'Specify specifying version range for semantic-release. If no version range is specified, latest version will be used by default'
branches:
required: false
description: 'The branches on which releases should happen. It will override the branches attribute in your configuration file. Support for semantic-release above v16. See https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches for more information.'
branch:
required: false
description: '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. Support for semantic-release older than v16.'
extra_plugins:
required: false
description: 'Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer.'
dry_run:
required: false
description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file'
extends:
required: false
description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
outputs:
new_release_published:
description: 'Whether a new release was published'
Expand All @@ -24,8 +34,10 @@ outputs:
description: 'Minor version of the new release'
new_release_patch_version:
description: 'Patch version of the new release'
new_release_channel:
description: 'The distribution channel on which the last release was initially made available (undefined for the default distribution channel).'
new_release_notes:
description: 'Release notes of the new release'
description: 'The release notes for the new release.'
runs:
using: 'node12'
main: 'index.js'
Loading

0 comments on commit 4a82c3c

Please sign in to comment.