Skip to content

Commit

Permalink
📝 Fix README and added enhancement on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeconias committed Feb 14, 2021
1 parent 7980288 commit 1f74f0b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Release:
Changelog:
# The type of runner that the job will run on
runs-on: ubuntu-latest

outputs:
shouldCreateRelease: ${{ steps.changelog.outputs.shouldCreateRelease }}
version: ${{ steps.changelog.outputs.version }}
release: ${{ steps.changelog.outputs.release }}
changelog: ${{ steps.changelog.outputs.changelog }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -31,13 +37,20 @@ jobs:
- name: Showing the last changelog
run: echo "${{steps.changelog.outputs.changelog}}"

Release:
needs: Changelog
if: needs.Changelog.outputs.shouldCreateRelease == 'true'

runs-on: ubuntu-latest

steps:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.version }}
release_name: ${{ steps.changelog.outputs.release }}
body: ${{steps.changelog.outputs.changelog}}
tag_name: ${{ needs.Changelog.outputs.version }}
release_name: ${{ needs.Changelog.outputs.release }}
body: ${{needs.Changelog.outputs.changelog}}
draft: false
prerelease: false
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ Read your README and copy the last information about changes for the new tag/rel
## How to use

Create the README file on the repository and add the changelog structure. Your struct should seem with:
(Ignore "\" on the example)

```
...
## Changelog
\<!-- Version start @@ {"version": "v0.1.1", tagtitle: "..."} --> Start of the last changelog
\<!-- Version start @@ {"version": "v0.1.1", "tagtitle": "..."} --> Start of the last changelog
- ### v0.1.1
Expand All @@ -33,7 +34,7 @@ Workflow example
steps:
- name: Read the README.md
id: changelog
uses: ./
uses: Jeconias/[email protected]
with:
path: "./README.md" # The path to read a README.md file. (Optional)
- name: Showing the last changelog
Expand All @@ -42,13 +43,21 @@ steps:
## Changelog
<!-- Version start @@ {"version": "v1", "release": "Initial"} -->
<!-- Version start @@ {"version": "v1.3", "release": "Initial", "shouldCreateRelease": "true"} -->
- ### v0.1.3
- Fix example.
<!-- Version end -->
- ### v0.1.2
- Fix README and added a condition to verify if should create a new release on workflow.
- ### v0.1.1
- Fix imports of main.ts
- Updated main.yml to use the Changelog Action to reading the README.md and create a release.
<!-- Version end -->
- ### v0.1.0
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Changelog"
name: "Read your README.md - Changelog"
description: "Read your README.md and copy the last information about changes for the new tag/release."
author: "Jeconias Santos"
branding:
icon: "activity"
color: "blue"
inputs:
path:
description: "The path to read a README.md file."
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultPath = "./README.md";
const handleDebug = (str: string) => core.debug(`[${actionName}]::${str}`);

async function run(): Promise<void> {
const isDebug = true || core.isDebug();
const isDebug = core.isDebug();

const path = core.getInput("path") || defaultPath;
const matchStart = defaultMatchStart;
Expand Down

0 comments on commit 1f74f0b

Please sign in to comment.