Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Dec 12, 2024
1 parent a8533c7 commit 942ebbf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 38 deletions.
45 changes: 16 additions & 29 deletions create-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ This action creates a release on GitHub:
2. Computing the checksum for the archived tarball.
3. Extracting the release notes from the changelog.

## GitHub Action Usage
## Action Inputs

Requirements:
- `contents: write` permission to the repository
- (optional) Python >=3.7
| Name | Description | Default |
| ---- | ----------- | ------- |
| `version` | Version to release. | **Required** |
| `branch` | Target branch to use for the release. | `${{ github.even.repository.default_branch` |
| `archive-name` | Name of the git archive to create. | `${{ github.event.repository.name }}-${{ inputs.version }}` |
| `output-directory` | Directory for the release artifacts. | `release` |
| `release-notes` | Name of the release notes to create. | `RELEASE_NOTES.md` |
| `release-token` | GitHub token to create the release.<br>Fine-grained PAT: `contents: write` | `${{ github.token }}` |

## Sample Workflows

### Basic Workflow

```yaml
name: Create Release
Expand All @@ -18,7 +27,7 @@ on:
workflow_dispatch:
inputs:
version:
description: Release version
description: The version to release.
required: true

permissions:
Expand All @@ -31,33 +40,11 @@ jobs:
- name: Create Release
uses: conda/actions/create-release
with:
# [required]
# the version to be released
version: ${{ inputs.version }}

# [required]
# the target branch for the release
branch: main

# [optional]
# name of the tarball archive
# archive-name: ${{ github.event.repository.name }}-${{ github.ref_name }}

# [optional]
# directory for the release artifacts
# output-directory: release

# [optional]
# path to the release notes
# release-notes: RELEASE_NOTES.md

# [optional]
# GitHub token to author release
# (`contents: write` for fine-grained PAT; `repo` for classic PAT)
# token: ${{ github.token }}
```
### Sample Workflow Creating Release using Dynamic Branch
### Dynamic Branch Workflow
```yaml
name: Create Release
Expand All @@ -66,7 +53,7 @@ on:
workflow_dispatch:
inputs:
version:
description: Release version
description: The version to release.
required: true

permissions:
Expand Down
16 changes: 7 additions & 9 deletions create-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ name: Create Release
description: Creates a release by archiving the source and creating a release on GitHub.
inputs:
version:
description: Release version.
description: Version to release.
required: true
branch:
description: Target branch for the release.
required: true
default: ${{ github.event.repository.default_branch }}
archive-name:
description: Name of the tarball archive.
default: ${{ github.event.repository.name }}-${{ github.ref_name }}
description: Name of the git archive.
default: ${{ github.event.repository.name }}-${{ inputs.version }}
output-directory:
description: Directory for the release artifacts.
default: release
release-notes:
description: Path to the release notes.
default: RELEASE_NOTES.md
token:
description: >-
GitHub token to author release
(`contents: write` for fine-grained PAT; `repo` for classic PAT).
release-token:
description: 'GitHub token to create the release. Fine-grained PAT: `contents: write`'
default: ${{ github.token }}
runs:
using: composite
Expand Down Expand Up @@ -66,7 +64,7 @@ runs:
- name: Create Release
shell: bash
env:
GH_TOKEN: ${{ input.token }}
GH_TOKEN: ${{ input.release-token }}
run: >
gh release create
--notes-file "${{ inputs.output-directory }}/${{ inputs.release-notes }}"
Expand Down

0 comments on commit 942ebbf

Please sign in to comment.