Skip to content

Commit 0fb3d10

Browse files
Merge pull request #77 from MatteoPologruto/switch-to-ncc-packaging
Use ncc to compile the action
2 parents 51cd93c + 1b412c9 commit 0fb3d10

File tree

193 files changed

+5205
-14097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+5205
-14097
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,10 @@ npm run test
4141

4242
### 6. Build
4343

44-
It is necessary to compile the code before it can be used by GitHub Actions. We check in the `node_modules` to provide runtime dependencies to the system using the Action, so be careful not to `git add` all the development dependencies you might have under your local `node_modules`.
45-
Remember to run these commands before committing any code changes:
44+
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:
4645

4746
```
48-
npm run build
49-
```
50-
51-
remove all the dependencies:
52-
53-
```
54-
rm -rf node_modules
55-
```
56-
57-
add back **only** the runtime dependencies:
58-
59-
```
60-
npm install --production
61-
```
62-
63-
check in the code that matters:
64-
65-
```
66-
git add lib node_modules
47+
task build
6748
```
6849

6950
### 7. Commit

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ 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
5153
# Unix-style EOL.
52-
run: git diff --ignore-cr-at-eol --color --exit-code lib
54+
run: git diff --ignore-cr-at-eol --color --exit-code dist

.github/workflows/test-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
push:
66
paths:
77
- ".github/workflows/test-integration.ya?ml"
8-
- "lib/**"
8+
- "dist/**"
99
- "action.yml"
1010
pull_request:
1111
paths:
1212
- ".github/workflows/test-integration.ya?ml"
13-
- "lib/**"
13+
- "dist/**"
1414
- "action.yml"
1515
schedule:
1616
# Run every Tuesday at 8 AM UTC to catch breakage caused by external changes.

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
/node_modules/
1+
# Dependency directory
2+
node_modules/
3+
4+
# Ignore built ts files
5+
__tests__/runner/*
6+
lib/**/*

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:

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
default: ''
1414
runs:
1515
using: 'node16'
16-
main: 'lib/main.js'
16+
main: 'dist/index.js'
1717
branding:
1818
icon: 'box'
1919
color: 'green'

0 commit comments

Comments
 (0)