Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit d39599b

Browse files
committed
updates readme
1 parent f08e55b commit d39599b

File tree

1 file changed

+68
-193
lines changed

1 file changed

+68
-193
lines changed

README.md

Lines changed: 68 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,213 +1,88 @@
1-
# Create a GitHub Action Using TypeScript
1+
# Setup Neosync CLI Action
22

3-
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
4-
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)
5-
[![Check dist/](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/check-dist.yml)
6-
[![CodeQL](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/actions/typescript-action/actions/workflows/codeql-analysis.yml)
3+
[![GitHub Super-Linter](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
4+
![CI](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/ci.yml/badge.svg)
5+
[![Check dist/](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/check-dist.yml/badge.svg)](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/check-dist.yml)
6+
[![CodeQL](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nucleuscloud/setup-neosync-cli-action/actions/workflows/codeql-analysis.yml)
77
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)
88

9-
Use this template to bootstrap the creation of a TypeScript action. :rocket:
9+
The `nucleuscloud/setup-neosync-cli-action` is a Typescript action that sets up Neosync CLI in your GitHub Actions workflow.
1010

11-
This template includes compilation support, tests, a validation workflow,
12-
publishing, and versioning guidance.
11+
- Downloads a specific version of Neosync CLI and adds it to the `PATH`.
1312

14-
If you are new, there's also a simpler introduction in the
15-
[Hello world JavaScript action repository](https://github.com/actions/hello-world-javascript-action).
13+
After you've used the action, subsequent steps in the same job can run Nucleus commands using [the GitHub Actions `run` syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun). This allows Neosync commands to work like they do on your local command line.
1614

17-
## Create Your Own Action
18-
19-
To create your own action, you can use this repository as a template! Just
20-
follow the below instructions:
21-
22-
1. Click the **Use this template** button at the top of the repository
23-
1. Select **Create a new repository**
24-
1. Select an owner and name for your new repository
25-
1. Click **Create repository**
26-
1. Clone your new repository
27-
28-
> [!CAUTION]
29-
>
30-
> Make sure to remove or update the [`CODEOWNERS`](./CODEOWNERS) file! For
31-
> details on how to use this file, see
32-
> [About code owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).
33-
34-
## Initial Setup
35-
36-
After you've cloned the repository to your local machine or codespace, you'll
37-
need to perform some initial setup steps before you can develop your action.
38-
39-
> [!NOTE]
40-
>
41-
> You'll need to have a reasonably modern version of
42-
> [Node.js](https://nodejs.org) handy (20.x or later should work!). If you are
43-
> using a version manager like [`nodenv`](https://github.com/nodenv/nodenv) or
44-
> [`nvm`](https://github.com/nvm-sh/nvm), this template has a `.node-version`
45-
> file at the root of the repository that will be used to automatically switch
46-
> to the correct version when you `cd` into the repository. Additionally, this
47-
> `.node-version` file is used by GitHub Actions in any `actions/setup-node`
48-
> actions.
49-
50-
1. :hammer_and_wrench: Install the dependencies
51-
52-
```bash
53-
npm install
54-
```
55-
56-
1. :building_construction: Package the TypeScript for distribution
57-
58-
```bash
59-
npm run bundle
60-
```
61-
62-
1. :white_check_mark: Run the tests
63-
64-
```bash
65-
$ npm test
66-
67-
PASS ./index.test.js
68-
✓ throws invalid number (3ms)
69-
wait 500 ms (504ms)
70-
test runs (95ms)
71-
72-
...
73-
```
74-
75-
## Update the Action Metadata
76-
77-
The [`action.yml`](action.yml) file defines metadata about your action, such as
78-
input(s) and output(s). For details about this file, see
79-
[Metadata syntax for GitHub Actions](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions).
80-
81-
When you copy this repository, update `action.yml` with the name, description,
82-
inputs, and outputs for your action.
83-
84-
## Update the Action Code
85-
86-
The [`src/`](./src/) directory is the heart of your action! This contains the
87-
source code that will be run when your action is invoked. You can replace the
88-
contents of this directory with your own code.
89-
90-
There are a few things to keep in mind when writing your action code:
91-
92-
- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
93-
In `main.ts`, you will see that the action is run in an `async` function.
94-
95-
```javascript
96-
import * as core from '@actions/core'
97-
//...
98-
99-
async function run() {
100-
try {
101-
//...
102-
} catch (error) {
103-
core.setFailed(error.message)
104-
}
105-
}
106-
```
107-
108-
For more information about the GitHub Actions toolkit, see the
109-
[documentation](https://github.com/actions/toolkit/blob/master/README.md).
110-
111-
So, what are you waiting for? Go ahead and start customizing your action!
112-
113-
1. Create a new branch
114-
115-
```bash
116-
git checkout -b releases/v1
117-
```
118-
119-
1. Replace the contents of `src/` with your action code
120-
1. Add tests to `__tests__/` for your source code
121-
1. Format, test, and build the action
122-
123-
```bash
124-
npm run all
125-
```
126-
127-
> [!WARNING]
128-
>
129-
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc)
130-
> to build the final JavaScript action code with all dependencies included.
131-
> If you do not run this step, your action will not work correctly when it is
132-
> used in a workflow. This step also includes the `--license` option for
133-
> `ncc`, which will create a license file for all of the production node
134-
> modules used in your project.
135-
136-
1. Commit your changes
137-
138-
```bash
139-
git add .
140-
git commit -m "My first action is ready!"
141-
```
142-
143-
1. Push them to your repository
144-
145-
```bash
146-
git push -u origin releases/v1
147-
```
148-
149-
1. Create a pull request and get feedback on your action
150-
1. Merge the pull request into the `main` branch
151-
152-
Your action is now published! :rocket:
15+
## Usage
15316

154-
For information about versioning your action, see
155-
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
156-
in the GitHub Actions toolkit.
17+
### Neosync CLI
15718

158-
## Validate the Action
19+
#### Download the latest Neosync CLI
20+
```yaml
21+
name: ci
22+
23+
on:
24+
push:
25+
branches: main
26+
27+
jobs:
28+
whoami:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Download Neosync CLI
32+
uses: nucleuscloud/setup-neosync-cli-action@v1
33+
- name: Whoami
34+
run: neosync whoami
35+
```
15936
160-
You can now validate the action by referencing it in a workflow file. For
161-
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
162-
action in the same repository.
37+
#### Download Neosync CLI at a specific version
16338
16439
```yaml
165-
steps:
166-
- name: Checkout
167-
id: checkout
168-
uses: actions/checkout@v4
169-
170-
- name: Test Local Action
171-
id: test-action
172-
uses: ./
173-
with:
174-
milliseconds: 1000
175-
176-
- name: Print Output
177-
id: output
178-
run: echo "${{ steps.test-action.outputs.time }}"
40+
name: ci
41+
42+
on:
43+
push:
44+
branches: main
45+
46+
jobs:
47+
whoami:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Download Neosync CLI
51+
uses: nucleuscloud/setup-neosync-cli-action@v1
52+
with:
53+
version: v0.0.18
54+
- name: Whoami
55+
run: neosync whoami
17956
```
18057
181-
For example workflow runs, check out the
182-
[Actions tab](https://github.com/actions/typescript-action/actions)! :rocket:
58+
#### Provide a Neosync API Key
59+
```yaml
60+
name: ci
61+
62+
on:
63+
push:
64+
branches: main
65+
66+
jobs:
67+
whoami:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Download Neosync CLI
71+
uses: nucleuscloud/setup-neosync-cli-action@v1
72+
- name: Whoami
73+
run: neosync whoami
74+
env:
75+
NEOSYNC_API_KEY: ${{ secrets.NEOSYNC_API_KEY }}
76+
```
18377
184-
## Usage
78+
## Customizing
18579
186-
After testing, you can create version tag(s) that developers can use to
187-
reference different stable versions of your action. For more information, see
188-
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
189-
in the GitHub Actions toolkit.
80+
### inputs
19081
191-
To include the action in a workflow in another repository, you can use the
192-
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
193-
hash.
82+
| Name | Type | Default | Required | Description |
83+
| --------- | ------ | ------- | -------- | ------------------- |
84+
| `version` | String | latest | false | Neosync CLI version |
19485

195-
```yaml
196-
steps:
197-
- name: Checkout
198-
id: checkout
199-
uses: actions/checkout@v4
200-
201-
- name: Test Local Action
202-
id: test-action
203-
uses: actions/typescript-action@v1 # Commit with the `v1` tag
204-
with:
205-
milliseconds: 1000
206-
207-
- name: Print Output
208-
id: output
209-
run: echo "${{ steps.test-action.outputs.time }}"
210-
```
21186

21287
## Publishing a new release
21388

0 commit comments

Comments
 (0)