From ab4e6935af8c908cd0fae8d6f59f6aaa1eec49dd Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Fri, 27 Jun 2025 20:36:25 -0300 Subject: [PATCH] feat: build-node-app --- .forgejo/actions/build-node-app/action.yaml | 54 +++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .forgejo/actions/build-node-app/action.yaml diff --git a/.forgejo/actions/build-node-app/action.yaml b/.forgejo/actions/build-node-app/action.yaml new file mode 100644 index 0000000..ea0d16e --- /dev/null +++ b/.forgejo/actions/build-node-app/action.yaml @@ -0,0 +1,54 @@ +name: Verify package.json version +description: This action build a nodejs app, and run the tests + +inputs: + test_action: + description: Name of the test script + default: test + required: false + + build_action: + description: Name of the build script + default: build + required: false + + build_path: + description: Path of the build output + default: dist + required: false + + artifact_name: + description: Name for the generated artifact + default: dist + required: false + +runs: + using: composite + steps: + - name: Install dependencies + shell: sh + run: apk add nodejs + + - name: Git Clone + uses: actions/checkout@v4 + + - name: Restore Node Modules Cache + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-nodejs-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nodejs- + + - name: Build and Test + shell: sh + run: | + npm install + npm run ${{ inputs.test_action }} + npm run ${{ inputs.build_action }} + + - uses: actions/upload-artifact@v3 + name: Upload Artifact + with: + name: ${{ inputs.artifact_name }} + path: ${{ inputs.build_path }}