Skip to content

Commit 1b412c9

Browse files
Use task based approach to build the action
1 parent ef396b0 commit 1b412c9

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ npm run test
4444
It is necessary to compile the code before it can be used by GitHub Actions. Remember to run these commands before committing any code changes:
4545

4646
```
47-
npm run build
48-
npm run pack
47+
task build
4948
```
5049

5150
### 7. Commit

.github/workflows/check-packaging-ncc-typescript-npm.yml renamed to .github/workflows/check-packaging-ncc-typescript-task.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ jobs:
3939
with:
4040
node-version: ${{ env.NODE_VERSION }}
4141

42-
- name: Install dependencies
43-
run: npm install
42+
- name: Install Task
43+
uses: arduino/setup-task@v1
44+
with:
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
version: 3.x
4447

4548
- name: Build project
46-
run: |
47-
npm run build
49+
run: task ts:build
4850

4951
- name: Check packaging
5052
# Ignoring CR because ncc's output has a mixture of line endings, while the repository should only contain

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![Check npm status](https://github.com/arduino/setup-protoc/actions/workflows/check-npm-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-npm-task.yml)
1111
[![Check TypeScript status](https://github.com/arduino/setup-protoc/actions/workflows/check-typescript-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-typescript-task.yml)
1212
[![Check tsconfig status](https://github.com/arduino/setup-protoc/actions/workflows/check-tsconfig-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-tsconfig-task.yml)
13-
[![Check Packaging status](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-npm.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-npm.yml)
13+
[![Check Packaging status](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-task.yml)
1414

1515
This action makes the `protoc` compiler available to Workflows.
1616

Taskfile.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ vars:
66
SCHEMA_DRAFT_4_AJV_CLI_VERSION: 3.3.0
77

88
tasks:
9+
build:
10+
desc: Build the project
11+
deps:
12+
- task: ts:build
13+
914
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-dependencies-task/Taskfile.yml
1015
general:prepare-deps:
1116
desc: Prepare project dependencies for license check
@@ -260,6 +265,15 @@ tasks:
260265
else
261266
echo "{{.RAW_PATH}}"
262267
fi
268+
269+
ts:build:
270+
desc: Build the action's TypeScript code.
271+
deps:
272+
- task: npm:install-deps
273+
cmds:
274+
- npx tsc
275+
- npx ncc build
276+
263277
ts:lint:
264278
desc: Lint TypeScript code
265279
deps:

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"description": "Setup protoc action",
66
"main": "lib/main.js",
77
"scripts": {
8-
"build": "tsc && ncc build",
98
"format": "prettier --write **/*.ts",
109
"format-check": "prettier --check **/*.ts",
1110
"test": "jest"

0 commit comments

Comments
 (0)