Skip to content

Commit

Permalink
Update README, packages (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
jablan authored Feb 22, 2023
1 parent f4d7941 commit 95bd7e0
Show file tree
Hide file tree
Showing 4 changed files with 2,511 additions and 2,607 deletions.
93 changes: 19 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,35 @@
# Create a JavaScript Action
# setup-cli

<p align="center">
<a href="https://github.com/actions/javascript-action/actions"><img alt="javscript-action status" src="https://github.com/actions/javascript-action/workflows/units-test/badge.svg"></a>
</p>
This action installs [Phrase](https://phrase.com/) [CLI tool](https://github.com/phrase/phrase-cli) for translation management.

Use this template to bootstrap the creation of a JavaScript action.:rocket:
# Usage

This template includes tests, linting, a validation workflow, publishing, and versioning guidance.
See [action.yml](action.yml)

If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)

## Create an action from this template

Click the `Use this Template` and provide the new repo details for your action

## Code in Main

Install the dependencies

```bash
npm install
```

Run the tests :heavy_check_mark:

```bash
$ npm test

PASS ./index.test.js
✓ throws invalid number (3ms)
wait 500 ms (504ms)
test runs (95ms)
...
```yaml
steps:
- uses: actions/checkout@v3
- uses: phrase/setup-cli@v1
with:
version: 2.6.6
- run: phrase pull
- run: phrase push --wait
```
## Change action.yml

The action.yml defines the inputs and output for your action.
Before running the tool, you need to configure it, typically using a configuration file named `.phrase.yml`. More information can be found [here](https://support.phrase.com/hc/en-us/articles/5808300599068-Using-the-CLI-Strings-).

Update the action.yml with your name, description, inputs and outputs for your action.
For authentication, you will probably want to use the authentication token passed through an environment variable `PHRASE_ACCESS_TOKEN`. More info at the support link above.

See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)

## Change the Code
# License

Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
The scripts and documentation in this project are released under the [MIT License](LICENSE)

```javascript
const core = require('@actions/core');
...
Most of the code has been copied over from https://github.com/winify-ag/setup-phraseapp (see https://github.com/phrase/phrase-cli/issues/119). Big thanks to original authors!

async function run() {
try {
...
}
catch (error) {
core.setFailed(error.message);
}
}
# Contributions

run()
```

See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
Contributions are welcome!

## Package for distribution

Expand All @@ -76,12 +43,6 @@ Run prepare
npm run prepare
```

Since the packaged index.js is run from the dist folder.

```bash
git add dist
```

## Create a release branch

Users shouldn't consume the action from master since that would be latest code and actions can break compatibility between major versions.
Expand All @@ -97,20 +58,4 @@ git commit -a -m "v1 release"
git push origin v1
```

Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! :rocket:

See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)

## Usage

You can now consume the action by referencing the v1 branch

```yaml
uses: actions/javascript-action@v1
with:
milliseconds: 1000
```
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
174 changes: 87 additions & 87 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 95bd7e0

Please sign in to comment.