Skip to content

Commit

Permalink
Merge pull request #53 from rainstormy/spdiswal/implement-github-action
Browse files Browse the repository at this point in the history
Implement GitHub Actions entrypoint
  • Loading branch information
spdiswal authored Oct 16, 2024
2 parents 221ea98 + f85a8fe commit 300a900
Show file tree
Hide file tree
Showing 43 changed files with 634 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
#
- name: Create a draft GitHub release
uses: rainstormy-actions/release/github@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
uses: rainstormy/release/github@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
with:
gh-auth-token: ${{ secrets.BOT_NIMBUS_GH_AUTH_TOKEN }}
version: ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: ./.github/actions/pnpm
#
- name: Publish the package to npm
uses: rainstormy-actions/release/npm@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
uses: rainstormy/release/npm@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
with:
access-level: public
npm-auth-token: ${{ secrets.BOT_NIMBUS_NPM_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ jobs:
token: ${{ secrets.BOT_NIMBUS_GH_AUTH_TOKEN }}
#
- name: Use Nimbus (Bot) in Git
uses: rainstormy-actions/rainstorm-release/bot-nimbus@9317ddb0235eac4f442e89565d0b5dec80135842
uses: rainstormy/rainstorm-release/bot-nimbus@9317ddb0235eac4f442e89565d0b5dec80135842
with:
bot-nimbus-ssh-public-key: ${{ secrets.BOT_NIMBUS_SSH_PUBLIC_KEY }}
__bot-nimbus-ssh-private-key__: ${{ secrets.BOT_NIMBUS_SSH___THE___PRIVATE___KEY }}
ssh-key-fingerprints-github: ${{ secrets.SSH_KEY_FINGERPRINTS_GITHUB }}
#
- name: Create a semantic version tag in Git
uses: rainstormy-actions/release/tag@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
uses: rainstormy/release/tag@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
with:
version: ${{ github.head_ref }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ jobs:
- name: Update release artifacts
# Run the newest version of Updraft on itself.
# language=sh
run: node ./bin/updraft.js --files 'package.json' --release-files 'CHANGELOG.md' --check-sequential-release --release-version $VERSION
run: node ./dist/cli/index.js --files 'package.json' --release-files 'CHANGELOG.md' --check-sequential-release --release-version $VERSION
env:
VERSION: ${{ inputs.version }}
#
- name: Use Nimbus (Bot) in Git
uses: rainstormy-actions/rainstorm-release/bot-nimbus@9317ddb0235eac4f442e89565d0b5dec80135842
uses: rainstormy/rainstorm-release/bot-nimbus@9317ddb0235eac4f442e89565d0b5dec80135842
with:
bot-nimbus-ssh-public-key: ${{ secrets.BOT_NIMBUS_SSH_PUBLIC_KEY }}
__bot-nimbus-ssh-private-key__: ${{ secrets.BOT_NIMBUS_SSH___THE___PRIVATE___KEY }}
ssh-key-fingerprints-github: ${{ secrets.SSH_KEY_FINGERPRINTS_GITHUB }}
#
- name: Create a release-triggering pull request in GitHub
uses: rainstormy-actions/release/pr@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
uses: rainstormy/release/pr@73fe3aae49ad74af650e529107d94f45002798fd # v1.1.0
with:
gh-auth-token: ${{ secrets.BOT_NIMBUS_GH_AUTH_TOKEN }}
version: ${{ inputs.version }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# Build artifacts
dist/
dist/*
!dist/gha/

# Caches and third-party dependencies
node_modules/
Expand Down
12 changes: 12 additions & 0 deletions .idea/runConfigurations/build_cli.xml

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations/build_gha.xml

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

12 changes: 12 additions & 0 deletions .idea/runConfigurations/build_lib.xml

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

4 changes: 3 additions & 1 deletion .idea/updraft.iml

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

10 changes: 10 additions & 0 deletions .idea/vcs.xml

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

18 changes: 18 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
"problemMatcher": [],
"label": "build"
},
{
"type": "npm",
"script": "build.cli",
"problemMatcher": [],
"label": "build.cli"
},
{
"type": "npm",
"script": "build.gha",
"problemMatcher": [],
"label": "build.gha"
},
{
"type": "npm",
"script": "build.lib",
"problemMatcher": [],
"label": "build.lib"
},
{
"type": "npm",
"script": "check",
Expand Down
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- An ESM export of the program entrypoint without usage instructions and without
support for the `--help` and `--version` options.
- A Node.js-based GitHub action: `rainstormy/updraft`.
- An ESM export of the program entrypoint with usage instructions and support
for the `--help` and `--version` options.

### Changed
- The main program entrypoint no longer supports the `--help` and `--version`
options.

## [1.1.0] - 2024-07-29
### Added
Expand Down
163 changes: 139 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@ Updraft prepares a repository for an upcoming release by updating changelogs and
bumping version numbers in `package.json` files.

It saves the changes to the files, but it does not make any Git commits or
GitHub releases. You can automate these things in your CI/CD pipeline or do them
manually after running the Updraft tool.
GitHub releases. You can automate these things in your CI/CD pipeline (it works
well with the [`rainstormy/release`](https://github.com/rainstormy/release)
actions), or you can do them manually after running the Updraft tool.

Supported file formats:

- Markdown `CHANGELOG.md` and AsciiDoc `CHANGELOG.adoc`
in [Keep a Changelog](https://keepachangelog.com/en/1.1.0) format.
- `package.json` files.

## Command-Line Tool
## Command-Line Interface (CLI)
### Installation
Install
the [`@rainstormy/updraft`](https://www.npmjs.com/package/@rainstormy/updraft)
package with the package manager of your choice:

```shell
npm install --save-dev --save-exact @rainstormy/updraft
npm install --save-dev @rainstormy/updraft
```
or
```shell
pnpm install --save-dev --save-exact @rainstormy/updraft
pnpm add --save-dev @rainstormy/updraft
```
or
```shell
yarn add --dev --exact @rainstormy/updraft
yarn add --dev @rainstormy/updraft
```

### Usage
```shell
updraft [options]
```

Examples:
Examples (see the [Options reference](#options) below):

```shell
updraft --files 'CHANGELOG.md' 'package.json' --release-version '1.1.0'
```
Expand All @@ -44,25 +48,136 @@ updraft \
--release-version '2.0.0-beta.1'
```

### Options
#### `--check-sequential-release`
Verify that `--release-version` specifies a valid increment from the latest
version detected in each file to be updated.
## GitHub Actions
### Usage
Use the `rainstormy/updraft` action to run Updraft on the file system of the
GitHub Actions runner.

Examples (see the [Options reference](#options) below):

```yaml
jobs:
prepare-release:
runs-on: ubuntu-24.04
timeout-minutes: 1
permissions: { }
steps:
- name: Check out the repository
uses: actions/checkout@v4
#
- name: Update release artifacts
uses: rainstormy/updraft@v1
with:
files: package.json
release-files: CHANGELOG.md
release-version: 1.1.0
```
```yaml
jobs:
prepare-release:
runs-on: ubuntu-24.04
timeout-minutes: 1
permissions: { }
steps:
- name: Check out the repository
uses: actions/checkout@v4
#
- name: Update release artifacts
uses: rainstormy/updraft@v1
with:
check-sequential-release: true
files: |
package.json
packages/**/package.json
release-files: CHANGELOG.md
release-version: ${{ inputs.version || github.head_ref }}
```
## Options
### `check-sequential-release`
Verify that [`release-version`](#release-version) specifies a valid increment
from the latest version detected in each file to be updated.

#### `--files <pattern-1> <pattern-2> <pattern-3>...`
```shell
# CLI:
updraft --check-sequential-release
```
```yaml
# GitHub Actions:
with:
check-sequential-release: true
```

### `files`
Update the files matching the specified glob patterns
whenever `--release-version` is specified.
whenever [`release-version`](#release-version) is specified.

#### `--prerelease-files <pattern-1> <pattern-2> <pattern-3>...`
```shell
# CLI:
updraft --files <pattern-1> <pattern-2> <pattern-3>...
```
```yaml
# GitHub Actions:
with:
files: |
<pattern-1>
<pattern-2>
<pattern-3>
...
```

### `prerelease-files`
Update the files matching the specified glob patterns only
when `--release-version` has a `-prerelease` or `+buildinfo` segment.
when [`release-version`](#release-version) has a `-prerelease` or `+buildinfo`
segment.

#### `--release-files <pattern-1> <pattern-2> <pattern-3>...`
```shell
# CLI:
updraft --prerelease-files <pattern-1> <pattern-2> <pattern-3>...
```
```yaml
# GitHub Actions:
with:
prerelease-files: |
<pattern-1>
<pattern-2>
<pattern-3>
...
```

### `release-files`
Update the files matching the specified glob patterns only
when `--release-version` does not have a `-prerelease` or `+buildinfo` segment.
when [`release-version`](#release-version) does not have a `-prerelease` or
`+buildinfo` segment.

```shell
# CLI:
updraft --release-files <pattern-1> <pattern-2> <pattern-3>...
```
```yaml
# GitHub Actions:
with:
release-files: |
<pattern-1>
<pattern-2>
<pattern-3>
...
```

### `release-version`
The [semantic version number](https://semver.org) (SemVer) of the next release
on the form `<major.minor.patch[-prerelease][+buildinfo]>`. The `-prerelease`
and `+buildinfo` segments are optional.

It accepts any input containing a substring that is a semantic version number,
e.g. `v2.0.0` or `release/1.5.0-rc.0`.

#### `--release-version <major.minor.patch[-prerelease][+buildinfo]>`
The [semantic version number](https://semver.org) (SemVer) of the next release.
The `-prerelease` and `+buildinfo` segments are optional. It accepts any input
containing a substring that is a semantic version number, e.g. `v2.0.0`
or `release/1.5.0-rc.0`.
```shell
# CLI:
updraft --release-version <major.minor.patch[-prerelease][+buildinfo]>
```
```yaml
# GitHub Actions:
with:
release-version: <major.minor.patch[-prerelease][+buildinfo]>
```
Loading

0 comments on commit 300a900

Please sign in to comment.