-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add init-npm action #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
025ca59
feat: add init-npm action
netanelC 803e5c5
feat: add init-npm action to repo README
netanelC ab18e91
feat: add cache npm to setup-node
netanelC 67a3c68
docs: add link to setup node supported version
netanelC badbad7
fix: set cache dependency path
netanelC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Init-npm repository | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - "actions/init-npm/**" | ||
|
|
||
| jobs: | ||
| test-init-npm: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Test init-npm action | ||
| uses: ./actions/init-npm | ||
| with: | ||
| node-version: '20.x' | ||
| path: ./test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Initialize NPM Action | ||
|
|
||
| This GitHub Action sets up Node.js, installs dependencies using npm, and builds the project. | ||
|
|
||
| ## 🛠 Inputs | ||
|
|
||
| | Name | Description | Default | Required | | ||
| |----------------|---------------------------------------|---------|----------| | ||
| | `node_version` | Node.js version to set up ([supported versions](https://github.com/actions/setup-node#supported-version-syntax)) | `20.x` | false | | ||
| | `path` | Path to the directory containing your Node.js project | `.` | false | | ||
|
|
||
| ## 🚀 Usage | ||
|
|
||
| <!-- x-release-please-start-version --> | ||
| ```yaml | ||
| - name: Initialize NPM Project | ||
| uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v0.0.0 | ||
| with: | ||
| node-version: '20.x' | ||
| ``` | ||
| <!-- x-release-please-end-version --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: init-npm | ||
| description: 'Initialize the repo with npm and install all the dependencies' | ||
| inputs: | ||
| node-version: | ||
| description: 'Node.js version' | ||
| required: true | ||
| default: '20.x' | ||
| path: | ||
| description: "Path to the Node.js directory" | ||
| default: "." | ||
| required: false | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| cache: 'npm' | ||
| cache-dependency-path: ${{ inputs.path }}/package-lock.json | ||
|
|
||
| - name: Install TS Project dependencies | ||
| shell: bash | ||
| run: npm ci | ||
| working-directory: ${{ inputs.path }} | ||
|
|
||
| - name: build | ||
| shell: bash | ||
| run: npm run build | ||
| working-directory: ${{ inputs.path }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.