From ec0191c66b8af261ee8d7d3f3d7a7909caa5dc3c Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Tue, 25 Mar 2025 13:02:03 -0700 Subject: [PATCH 1/3] Add publish/download artifact feature to node-ci --- .github/workflows/node-ci.yml | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index e21a4f6..d1ea6f7 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -59,6 +59,26 @@ on: pre-run-script: required: false type: string + upload-artifact-name: + required: false + type: string + upload-artifact-path: + required: false + description: The full path to the artifact directory, this path does not take working-directory into account + type: string + default: . + download-artifact-name: + required: false + type: string + download-artifact-pattern: + required: false + type: string + download-artifact-path: + required: false + description: The full path to the artifact directory, this path does not take working-directory into account + type: string + default: . + secrets: npm-auth-token: description: NPM auth token (don't pass in on a PR build on a public repository) @@ -81,7 +101,7 @@ jobs: # setup node + private repo access - name: Use Node.js ${{ inputs.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} registry-url: 'https://npm.pkg.github.com' @@ -89,6 +109,15 @@ jobs: cache: 'npm' cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json + + - name: Download artifacts + if: ${{ inputs.download-artifact-name || inputs.download-artifact-pattern }} + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.download-artifact-name }} + pattern: ${{ inputs.download-artifact-pattern }} + path: ${{ inputs.download-artifact-path }} + - name: Pre-run if: ${{ inputs.pre-run-script }} run: ${{ inputs.pre-run-script }} @@ -139,3 +168,10 @@ jobs: # CDK infrastructure build calls npm ci on /infrastructure/build, which may fail without NODE_AUTH_TOKEN env: NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token || secrets.GITHUB_TOKEN }} + + - name: Publish artifact + if: ${{ inputs.upload-artifact-name }} + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.upload-artifact-name }} + path: ${{ inputs.upload-artifact-path }} From e959259c7fbf862654df2a967cd55d651791e34c Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Tue, 25 Mar 2025 13:02:29 -0700 Subject: [PATCH 2/3] Add optional setup python step to node-ci --- .github/workflows/node-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index d1ea6f7..4468690 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -5,6 +5,9 @@ on: required: false type: string default: 18.x + python-version: + required: false + type: string working-directory: required: false type: string @@ -109,6 +112,11 @@ jobs: cache: 'npm' cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json + - name: Set up Python + if: ${{ inputs.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} - name: Download artifacts if: ${{ inputs.download-artifact-name || inputs.download-artifact-pattern }} From 495b8eb6654fa5b7a6b62afd2a3f6086f8d35d48 Mon Sep 17 00:00:00 2001 From: Tristan Menzel Date: Tue, 25 Mar 2025 13:02:53 -0700 Subject: [PATCH 3/3] Add optional post build script step to node-ci --- .github/workflows/node-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 4468690..33e7515 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -47,6 +47,9 @@ on: required: false type: string default: npm run build + post-build-script: + required: false + type: string run-build: required: false type: boolean @@ -177,6 +180,10 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token || secrets.GITHUB_TOKEN }} + - name: Post build + if: ${{ inputs.post-build-script }} + run: ${{ inputs.post-build-script }} + - name: Publish artifact if: ${{ inputs.upload-artifact-name }} uses: actions/upload-artifact@v4