-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Fresa/create-action
Create action
- Loading branch information
Showing
18 changed files
with
2,790 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"no-console": 1, // Means warning | ||
"prettier/prettier": 2 // Means error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
mode: ContinuousDelivery | ||
# Conventional Commits https://www.conventionalcommits.org/en/v1.0.0/ | ||
# https://regex101.com/r/Ms7Vx6/2 | ||
major-version-bump-message: "(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([a-z]+\\))?(!: .+|: (.+\\n\\n)+BREAKING CHANGE: .+)" | ||
# https://regex101.com/r/Oqhi2m/1 | ||
minor-version-bump-message: "(feat)(\\([a-z]+\\))?: .+" | ||
# https://regex101.com/r/f5C4fP/1 | ||
patch-version-bump-message: "(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([a-z]+\\))?: .+" | ||
# Match nothing | ||
no-bump-message: ^\b$ | ||
continuous-delivery-fallback-tag: '' | ||
branches: | ||
development: | ||
increment: Patch | ||
# Everything except main and master | ||
regex: ^(?!(main|master)$) | ||
track-merge-target: true | ||
source-branches: [] | ||
feature: | ||
# Match nothing | ||
regex: ^\b$ | ||
develop: | ||
# Match nothing | ||
regex: ^\b$ | ||
main: | ||
source-branches: [] | ||
release: | ||
# Match nothing | ||
regex: ^\b$ | ||
pull-request: | ||
# Match nothing | ||
regex: ^\b$ | ||
hotfix: | ||
# Match nothing | ||
regex: ^\b$ | ||
support: | ||
# Match nothing | ||
regex: ^\b$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Fetches entire history, so we can analyze commits since last tag | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
- name: Install | ||
run: npm ci | ||
- name: Check | ||
run: npm run prettier-check | ||
- name: Build | ||
run: npm run publish | ||
- name: Test Fetching Artifact | ||
run: | | ||
GITHUB_ACTION_REPOSITORY=Fresa/release-notes-generator \ | ||
GITHUB_ACTION_REF=vTEST \ | ||
node fetch_artifact.js | ||
- name: Assert Artifact Downloaded | ||
run: ls -d $GITHUB_WORKSPACE/dist/index.js | ||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0.9.7 | ||
with: | ||
versionSpec: '5.x' | ||
- name: Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/execute@v0 | ||
with: | ||
useConfigFile: true | ||
configFilePath: .github/version_config.yml | ||
- name: Determine Release Info | ||
id: release | ||
run: | | ||
from_tag=$(git tag --points-at ${{ steps.gitversion.outputs.versionSourceSha }} | grep -m 1 ^v[0-9]*\.[0-9]*\.[0-9]* | head -1) | ||
[[ -z "$from_tag" ]] && \ | ||
from_ref_exclusive=${{ steps.gitversion.outputs.versionSourceSha }} || \ | ||
from_ref_exclusive=$from_tag | ||
[[ -z "${{ steps.gitversion.outputs.preReleaseNumber }}" ]] && \ | ||
is_prerelease=false || \ | ||
is_prerelease=true | ||
[[ is_prerelease ]] && \ | ||
tag=v${{ steps.gitversion.outputs.majorMinorPatch }}-pre-${{ steps.gitversion.outputs.shortSha }} || \ | ||
tag=v${{ steps.gitversion.outputs.majorMinorPatch }} | ||
echo "::set-output name=is_prerelease::$is_prerelease" | ||
echo "::set-output name=tag::$tag" | ||
echo "::set-output name=from_ref_exclusive::$from_ref_exclusive" | ||
- name: Create Tag | ||
uses: actions/github-script@v3 | ||
with: | ||
script: | | ||
github.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/${{ steps.release.outputs.tag }}", | ||
sha: "${{ steps.gitversion.outputs.sha }}" | ||
}); | ||
- name: Generate Release Notes | ||
id: release_notes | ||
uses: ./ | ||
with: | ||
version: ${{ steps.release.outputs.tag }} | ||
from_ref_exclusive: ${{ steps.release.outputs.from_ref_exclusive }} | ||
to_ref_inclusive: ${{ steps.release.outputs.tag }} | ||
- name: Package | ||
run: zip -rj artifacts.zip dist | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: ${{ steps.release_notes.outputs.release_notes }} | ||
tag_name: ${{ steps.release.outputs.tag }} | ||
prerelease: ${{ steps.release.outputs.is_prerelease }} | ||
files: artifacts.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Update Latest Minor Tag | ||
uses: EndBug/latest-tag@v1 | ||
if: steps.release.outputs.is_prerelease == false | ||
with: | ||
tag-name: v${{ steps.gitversion.outputs.major }} | ||
description: ${{ steps.release.outputs.tag }} | ||
- name: Update Latest Patch Tag | ||
uses: EndBug/latest-tag@v1 | ||
if: steps.release.outputs.is_prerelease == false | ||
with: | ||
tag-name: v${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }} | ||
description: ${{ steps.release.outputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,5 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
lib/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode | ||
dist | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,48 @@ | ||
# release-notes-generator | ||
|
||
A Github Action for semantic-release/release-notes-generator | ||
|
||
[![Build](https://github.com/Fresa/release-notes-generator/actions/workflows/ci.yml/badge.svg)](https://github.com/Fresa/release-notes-generator/actions/workflows/ci.yml) | ||
|
||
## Installation | ||
|
||
```yaml | ||
name: Generate release notes | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Fetches entire history, so we can analyze commits since last tag | ||
fetch-depth: 0 | ||
- name: Generate release notes | ||
id: release_notes | ||
uses: fresa/release-notes-generator@master | ||
with: | ||
version: v2.0.0 | ||
from_ref_exclusive: v1.0.1 | ||
to_ref_inclusive: v2.0.0 | ||
- run: echo "${{ steps.release_notes.outputs.release_notes }}" | ||
``` | ||
### 📥 Inputs | ||
- **github_token** _(required)_ - The Github token used to query this repository.(default: `${{ github.token }}`) | ||
- **version** _(required)_ - The version of the release. | ||
Example: 2.4.0 | ||
- **from_tag_exclusive** _(required)_ - The tag where to start gather commits. The tagged commit is not included. | ||
Examples: | ||
- tags/v1.0.1 | ||
- v1.0.1 | ||
- heads/my-branch | ||
- my-branch | ||
- 431880b | ||
- **to_tag_inclusive** _(required)_ - The tag where to stop gather commits. The tagged commit is included. | ||
Examples: | ||
- tags/v2.0.0 | ||
- v2.0.0 | ||
- heads/master | ||
- master | ||
- 531c800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Release Notes Generator' | ||
description: 'Generates release notes using semantic-release/release-notes-generator' | ||
author: 'Fredrik Arvidsson' | ||
inputs: | ||
github_token: | ||
description: 'The Github token used to query this repository' | ||
required: true | ||
default: ${{ github.token }} | ||
version: | ||
description: 'The version of the release' | ||
required: true | ||
from_ref_exclusive: | ||
description: >- | ||
The commit reference to gather commits after. | ||
The reference can be a tag, a branch or a commit sha. | ||
Examples: | ||
tags/v1.0.1 | ||
v1.0.1 | ||
heads/my-branch | ||
my-branch | ||
431880b | ||
required: true | ||
to_ref_inclusive: | ||
description: >- | ||
The last commit reference to include. | ||
The reference can be a tag, a branch or a commit sha. | ||
Examples: | ||
tags/v2.0.0 | ||
v2.0.0 | ||
heads/master | ||
master | ||
531c800 | ||
required: true | ||
outputs: | ||
release_notes: | ||
description: 'Semantic release notes' | ||
runs: | ||
using: 'node12' | ||
pre: 'fetch_artifact.js' | ||
main: 'dist/index.js' | ||
branding: | ||
icon: 'file-text' | ||
color: 'orange' |
Oops, something went wrong.