Skip to content

Commit

Permalink
Merge pull request #14 from PrefectHQ/add-working-dir-input
Browse files Browse the repository at this point in the history
Add an optional input for providing a working dir
  • Loading branch information
pleek91 authored Jan 15, 2025
2 parents 84e7b19 + 37ed848 commit 8b1fe50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Releases UI components using shared release manifest
| NPM_RELEASE_TOKEN | Secret/Env Var containing the NPM token used for releases. | true |
| RELEASE_TYPE | The type of release to perform. (major, minor, patch) | true |
| SKIP_BUILD | Bool for whether or not to skip the build step (req by eslint-config). | false |
| WORKING_DIR | Directory containing the package to build and release. Defaults to repository root ('.') | false |

## Usage
```yaml
Expand Down Expand Up @@ -42,4 +43,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TYPE: ${{ inputs.release_type }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_SUPER_SECRET }}
WORKING_DIR: 'packages/ui-components' # Optional: specify a different working directory
```
9 changes: 9 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: Skip the build step.
required: true
default: 'false'
WORKING_DIR:
description: The directory containing the package to build and release. Defaults to repository root.
required: false
default: '.'
outputs:
version:
value: ${{ steps.publish.outputs.version }}
Expand All @@ -33,6 +37,7 @@ runs:

- name: Bump Package Version
id: bump_version
working-directory: ${{ inputs.WORKING_DIR }}
run: |
npm version ${{ inputs.RELEASE_TYPE }}
echo "RELEASE_VERSION=$(cat package.json | jq .version | tr -d '"')" >> $GITHUB_ENV
Expand All @@ -41,6 +46,7 @@ runs:
- name: Bump Version and Create Release
env:
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
working-directory: ${{ inputs.WORKING_DIR }}
run: |
git checkout -b $RELEASE_VERSION
git push --set-upstream origin $RELEASE_VERSION
Expand All @@ -53,11 +59,13 @@ runs:
ref: main

- name: Install Dependencies
working-directory: ${{ inputs.WORKING_DIR }}
run: npm ci
shell: bash

- name: Build Package
if: ${{ inputs.SKIP_BUILD == 'false' }}
working-directory: ${{ inputs.WORKING_DIR }}
run: npm run build
shell: bash

Expand All @@ -68,6 +76,7 @@ runs:
token: ${{ inputs.NPM_TOKEN }}
strategy: upgrade
access: public
package: ${{ inputs.WORKING_DIR }}/package.json

- name: Create Release
if: ${{ steps.publish.outputs.type }}
Expand Down

0 comments on commit 8b1fe50

Please sign in to comment.