Skip to content

Commit

Permalink
docs: add comments...add extra example ussage
Browse files Browse the repository at this point in the history
  • Loading branch information
nickatnight committed Aug 26, 2022
1 parent b858b1b commit eefab2f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ Other notable packages that did not satisfy my use case:
* https://github.com/release-it/release-it (npm package rather than an action, but still could not release from branch)
* https://github.com/aaiezza/create-release (too bloated with features/libraries I don't need, and relies on deprecated auth method)

## Usage
## Usage 1
```yaml
name: Tag it
name: Tag it with defaults

on: push
on:
push:
tags:
- "*"

jobs:
create-release:
Expand Down Expand Up @@ -45,6 +48,47 @@ jobs:
steps:
...

```
## Usage 2
```yaml
name: Tag it with parameters

on:
push:
tags:
- "*"

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Release
id: create_release
uses: nickatnight/releases-action@v3
if: startsWith(github.ref, 'refs/tags/')
with:
branch: "main"
name: "Gryffindor Release"
message: "Yer a wizard Harry"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

outputs:
ReleaseTag: ${{ steps.create_release.outputs.release_tag }}

# pass in as env variable
conquer-muggles:
runs-on: ubuntu-latest
needs: [create-release]
env:
RELEASE_TAG: ${{ needs.create-release.outputs.ReleaseTag }}
steps:
...

```

## Supported Parameters
Expand Down
2 changes: 2 additions & 0 deletions releases-action
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --m

echo "Previous tag: ${PREVIOUS_TAG}"

# if no tagged is supplied, pull the most recently pushed tag (the tag that triggered this action)
if [[ -z ${TAG} ]]; then
TAG=$(git describe --tags --match=* --abbrev=0)
fi

# basic formatting check to or to not prepend "v" to tag
if [[ -z ${NAME} ]]; then
if [[ ${TAG:0:1} == "v" ]]; then
NAME="Release ${TAG}"
Expand Down

0 comments on commit eefab2f

Please sign in to comment.