|
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 | +# Set up a Git for Windows SDK (or a subset thereof) |
4 | 2 |
|
5 |
| -# Create a JavaScript Action using TypeScript |
| 3 | +Use this Action to initialize an environment to develop Git for Windows. |
6 | 4 |
|
7 |
| -Use this template to bootstrap the creation of a TypeScript action.:rocket: |
| 5 | +## Getting Started |
8 | 6 |
|
9 |
| -This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance. |
10 |
| - |
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) |
12 |
| - |
13 |
| -## Create an action from this template |
14 |
| - |
15 |
| -Click the `Use this Template` and provide the new repo details for your action |
16 |
| - |
17 |
| -## Code in Main |
18 |
| - |
19 |
| -> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance. |
20 |
| -
|
21 |
| -Install the dependencies |
22 |
| -```bash |
23 |
| -$ npm install |
24 |
| -``` |
25 |
| - |
26 |
| -Build the typescript and package it for distribution |
27 |
| -```bash |
28 |
| -$ npm run build && npm run package |
| 7 | +```yaml |
| 8 | +name: Build stuff in Git for Windows' SDK |
| 9 | +on: [push] |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: windows-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - name: Setup Git for Windows' minimal SDK |
| 16 | + uses: git-for-windows/setup-git-for-windows-sdk@v1 |
| 17 | + - name: Build |
| 18 | + shell: bash |
| 19 | + run: make |
29 | 20 | ```
|
30 | 21 |
|
31 |
| -Run the tests :heavy_check_mark: |
32 |
| -```bash |
33 |
| -$ npm test |
| 22 | +## Available flavors |
34 | 23 |
|
35 |
| - PASS ./index.test.js |
36 |
| - ✓ throws invalid number (3ms) |
37 |
| - ✓ wait 500 ms (504ms) |
38 |
| - ✓ test runs (95ms) |
| 24 | +It supports several flavors: |
39 | 25 |
|
40 |
| -... |
41 |
| -``` |
| 26 | +- `minimal`: |
42 | 27 |
|
43 |
| -## Change action.yml |
| 28 | + This is the most useful flavor to build Git for Windows' source code and run its own test suite. Only available for x86_64. |
44 | 29 |
|
45 |
| -The action.yml contains defines the inputs and output for your action. |
| 30 | +- `makepkg-git`: |
46 | 31 |
|
47 |
| -Update the action.yml with your name, description, inputs and outputs for your action. |
| 32 | + This flavor allows packaging `mingw-w64-git`, the Pacman package. It is only available for x86_64 but can be used to "cross-compile" for i686. |
48 | 33 |
|
49 |
| -See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions) |
| 34 | +- `build-installers`: |
50 | 35 |
|
51 |
| -## Change the Code |
| 36 | + In addition to building `mingw-w64-git`, this flavor allows bundling Git for Windows' artifacts such as the installer and the Portable Git. |
52 | 37 |
|
53 |
| -Most toolkit and CI/CD operations involve async operations so the action is run in an async function. |
| 38 | +- `full`: |
54 | 39 |
|
55 |
| -```javascript |
56 |
| -import * as core from '@actions/core'; |
57 |
| -... |
| 40 | + This is the "full" SDK, [as users would install it](https://gitforwindows.org/#download-sdk), with a pre-selected set of packages pre-installed. Additional packages can be installed via `pacman -S <package>`. |
58 | 41 |
|
59 |
| -async function run() { |
60 |
| - try { |
61 |
| - ... |
62 |
| - } |
63 |
| - catch (error) { |
64 |
| - core.setFailed(error.message); |
65 |
| - } |
66 |
| -} |
| 42 | +## CPU architecture support |
67 | 43 |
|
68 |
| -run() |
69 |
| -``` |
| 44 | +The Git for Windows SDK can be installed targeting `x86_64` (AKA "64-bit") and `i686` (AKA 32-bit). |
70 | 45 |
|
71 |
| -See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages. |
| 46 | +## Developing _this_ Action |
72 | 47 |
|
73 |
| -## Publish to a distribution branch |
| 48 | +> First, you'll need to have a reasonably modern version of `node` handy, such as Node 12. |
74 | 49 |
|
75 |
| -Actions are run from GitHub repos so we will checkin the packed dist folder. |
| 50 | +Install the dependencies |
76 | 51 |
|
77 |
| -Then run [ncc](https://github.com/zeit/ncc) and push the results: |
78 | 52 | ```bash
|
79 |
| -$ npm run package |
80 |
| -$ git add dist |
81 |
| -$ git commit -a -m "prod dependencies" |
82 |
| -$ git push origin releases/v1 |
| 53 | +$ npm install |
83 | 54 | ```
|
84 | 55 |
|
85 |
| -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. |
| 56 | +Build the Action and package it for distribution |
86 | 57 |
|
87 |
| -Your action is now published! :rocket: |
| 58 | +```bash |
| 59 | +$ npm run build && npm run package |
| 60 | +``` |
88 | 61 |
|
89 |
| -See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) |
| 62 | +Run the tests :heavy_check_mark: |
90 | 63 |
|
91 |
| -## Validate |
| 64 | +```bash |
| 65 | +$ npm test |
92 | 66 |
|
93 |
| -You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)) |
| 67 | + PASS ./index.test.js |
| 68 | + ✓ throws invalid number (3ms) |
| 69 | + ✓ wait 500 ms (504ms) |
| 70 | + ✓ test runs (95ms) |
94 | 71 |
|
95 |
| -```yaml |
96 |
| -uses: ./ |
97 |
| -with: |
98 |
| - milliseconds: 1000 |
| 72 | +... |
99 | 73 | ```
|
100 |
| -
|
101 |
| -See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket: |
102 |
| -
|
103 |
| -## Usage: |
104 |
| -
|
105 |
| -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 |
0 commit comments