|
1 | | -<p align="center"> |
2 | | - <a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a> |
3 | | -</p> |
| 1 | +# GitHub Action - Match Angular Versions |
4 | 2 |
|
5 | | -# Create a JavaScript Action using TypeScript |
| 3 | +This GitHub Action (written in JavaScript) modifies the root `package.json` of a project and replaces the version of all **Angular** related dependencies for given base version. |
6 | 4 |
|
7 | | -Use this template to bootstrap the creation of a TypeScript action.:rocket: |
| 5 | +[](https://github.com/ngworker/) |
8 | 6 |
|
9 | | -This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance. |
| 7 | +## Usage |
10 | 8 |
|
11 | | -If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action) |
| 9 | +### Pre-requisites |
12 | 10 |
|
13 | | -## Create an action from this template |
| 11 | +Create a workflow `.yml` file in your repositories `.github/workflows` directory. An [example workflow](#example-workflow---match-Angular-versions) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file). |
14 | 12 |
|
15 | | -Click the `Use this Template` and provide the new repo details for your action |
| 13 | +### Inputs |
16 | 14 |
|
17 | | -## Code in Main |
| 15 | +- `angular_version`: The base Angular version used to match the dependency version. Ex: 8.0.0, 10.0.14. To check the full list of supported versions, see [supported versions](###Supported-Angular-versions). |
18 | 16 |
|
19 | | -Install the dependencies |
20 | | -```bash |
21 | | -$ npm install |
22 | | -``` |
23 | | - |
24 | | -Build the typescript and package it for distribution |
25 | | -```bash |
26 | | -$ npm run build && npm run package |
27 | | -``` |
28 | | - |
29 | | -Run the tests :heavy_check_mark: |
30 | | -```bash |
31 | | -$ npm test |
32 | | - |
33 | | - PASS ./index.test.js |
34 | | - ✓ throws invalid number (3ms) |
35 | | - ✓ wait 500 ms (504ms) |
36 | | - ✓ test runs (95ms) |
37 | | - |
38 | | -... |
39 | | -``` |
40 | | - |
41 | | -## Change action.yml |
42 | | - |
43 | | -The action.yml contains defines the inputs and output for your action. |
44 | | - |
45 | | -Update the action.yml with your name, description, inputs and outputs for your action. |
46 | | - |
47 | | -See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions) |
48 | | - |
49 | | -## Change the Code |
| 17 | +### Example workflow - match Angular versions |
50 | 18 |
|
51 | | -Most toolkit and CI/CD operations involve async operations so the action is run in an async function. |
52 | | - |
53 | | -```javascript |
54 | | -import * as core from '@actions/core'; |
55 | | -... |
56 | | - |
57 | | -async function run() { |
58 | | - try { |
59 | | - ... |
60 | | - } |
61 | | - catch (error) { |
62 | | - core.setFailed(error.message); |
63 | | - } |
64 | | -} |
65 | | - |
66 | | -run() |
67 | | -``` |
68 | | - |
69 | | -See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages. |
70 | | - |
71 | | -## Publish to a distribution branch |
72 | | - |
73 | | -Actions are run from GitHub repos so we will checkin the packed dist folder. |
74 | | - |
75 | | -Then run [ncc](https://github.com/zeit/ncc) and push the results: |
76 | | -```bash |
77 | | -$ npm run package |
78 | | -$ git add dist |
79 | | -$ git commit -a -m "prod dependencies" |
80 | | -$ git push origin releases/v1 |
| 19 | +```yaml |
| 20 | +todo: 'Complete example later' |
81 | 21 | ``` |
82 | 22 |
|
83 | | -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. |
| 23 | +This will replace the version of several dependencies related to Angular in the package.json. It will use versions compatible with the given Angular version. |
84 | 24 |
|
85 | | -Your action is now published! :rocket: |
| 25 | +### Supported Angular versions |
86 | 26 |
|
87 | | -See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) |
| 27 | +At the moment this actions supports a limited set of Angular versions listed below. |
88 | 28 |
|
89 | | -## Validate |
| 29 | +- 8.0.0 |
| 30 | +- 9.0.0 |
| 31 | +- 10.0.0 |
90 | 32 |
|
91 | | -You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)) |
92 | | - |
93 | | -```yaml |
94 | | -uses: ./ |
95 | | -with: |
96 | | - milliseconds: 1000 |
97 | | -``` |
| 33 | +## Contributing |
98 | 34 |
|
99 | | -See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket: |
| 35 | +We would love you to contribute to `@ngworker/angular-versions-action`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information. |
100 | 36 |
|
101 | | -## Usage: |
| 37 | +## License |
102 | 38 |
|
103 | | -After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action |
| 39 | +The scripts and documentation in this project are released under the [MIT License](LICENSE) |
0 commit comments