Skip to content

Commit

Permalink
Add node-version parameters (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashuk authored Nov 20, 2023
1 parent d0cb1da commit 711fad8
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 37 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-cameras-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'davinci-github-actions': minor
---

- add option of specifying the version of Node.js used for some of the actions (`build-publish-alpha-package`, `build-push-image`, `deploy-storybook`, `report-affected-packages`)
2 changes: 1 addition & 1 deletion .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Node.js 18.x
- name: Set up Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# This forces changesets to use git user, provided by GITHUB_TOKEN env var
persist-credentials: false

- name: Setup node
- name: Set up node
uses: actions/[email protected]
with:
node-version: 18
Expand Down
11 changes: 6 additions & 5 deletions build-publish-alpha-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ Uses `yarn build:package` command to build the package.

The list of arguments, that are used in GH Action:

| name | type | required | default | description |
| ------------- | ------ | -------- | ------- | ----------------------------------------------------- |
| `npm-token` | string || | NPM token used for publishing. Has to be type Publish |
| `branch` | string || | Name of the branch that will be published |
| `root-folder` | string | | | Root folder of a package to be published |
| name | type | required | default | description |
| -------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------- |
| `npm-token` | string || | NPM token used for publishing. Has to be type Publish |
| `branch` | string || | Name of the branch that will be published |
| `root-folder` | string | | | Root folder of a package to be published |
| `node-version` | string | | 18 | Node.js version used. The action is guaranteed to work only with Node.js@18 (default value) |

### Outputs

Expand Down
8 changes: 6 additions & 2 deletions build-publish-alpha-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
root-folder:
required: false
description: 'Root folder of a package to be published || string'
node-version:
required: false
default: 18
description: 'Node.js version used. The action is guaranteed to work only with Node.js@18 (default value)'

runs:
using: composite
Expand All @@ -26,10 +30,10 @@ runs:
run: |
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
- name: Setup node
- name: Set up node
uses: actions/[email protected]
with:
node-version: 18
node-version: ${{ inputs.node-version }}

- uses: toptal/davinci-github-actions/[email protected]

Expand Down
17 changes: 9 additions & 8 deletions build-push-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ This GH Action builds a Docker image and pushes to google cloud.

The list of arguments, that are used in GH Action:

| name | type | required | default | description |
| ---------------- | ----------------------------------------------------------- | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `sha` | string || | Commit hash that will be used as a tag for the Docker image |
| `image-name` | string || | Name of the Docker image. Might be used in the next steps (for ex.: deploy a Docker image) |
| `environment` | enum<<br/>`temploy`,<br/>`staging`,<br/>`production`,<br/>> | | staging | Determines additional procedures while creating a Docker image. |
| `build-args` | string || | Multiline string to describe build arguments that will be used during dockerization |
| `docker-file` | string | | ./davinci/packages/ci/src/configs/docker/Dockerfile.gha-deploy | pathname to Docker file |
| `davinci-branch` | string | | master | Custom davinci branch |
| name | type | required | default | description |
| ---------------- | ----------------------------------------------------------- | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `sha` | string || | Commit hash that will be used as a tag for the Docker image |
| `image-name` | string || | Name of the Docker image. Might be used in the next steps (for ex.: deploy a Docker image) |
| `environment` | enum<<br/>`temploy`,<br/>`staging`,<br/>`production`,<br/>> | | staging | Determines additional procedures while creating a Docker image. |
| `build-args` | string || | Multiline string to describe build arguments that will be used during dockerization |
| `docker-file` | string | | ./davinci/packages/ci/src/configs/docker/Dockerfile.gha-deploy | pathname to Docker file |
| `davinci-branch` | string | | master | Custom davinci branch |
| `node-version` | string | | 18 | Node.js version used. The action is guaranteed to work only with Node.js@18 (default value) |

### Outputs

Expand Down
10 changes: 7 additions & 3 deletions build-push-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,26 @@ inputs:
description: 'Custom davinci branch'
required: false
default: 'master'
node-version:
required: false
default: 18
description: 'Node.js version used. The action is guaranteed to work only with Node.js@18 (default value)'

runs:
using: composite
steps:
- name: Checkout davinci
- name: Check out davinci
uses: actions/checkout@v3
with:
repository: toptal/davinci
token: ${{ env.GITHUB_TOKEN }}
path: davinci
ref: ${{ inputs.davinci-branch }}

- name: Setup node
- name: Set up node
uses: actions/[email protected]
with:
node-version: 18
node-version: ${{ inputs.node-version }}

- id: meta-latest
shell: bash
Expand Down
29 changes: 15 additions & 14 deletions deploy-storybook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ Currently ENV variables for Storybook are not supported.

The list of arguments, that are used in GH Action:

| name | type | required | default | description |
| ------------------------ | ------------------------------------------ | -------- | ------------------ | --------------------------------------------------------------------------------------- |
| `sha` | string || | Commit hash that will be used as a tag for the Docker image |
| `environment` | enum<<br/>`temploy`,<br/>`staging`,<br/>>' || | Environment to deploy Storybook to |
| `env-file` | string | | .env.temploy | `.env` file name from which to read variables. Required for temploy deployment only |
| `davinci-branch` | string | | master | Custom davinci branch |
| `dist-folder` | string | | ./storybook-static | Path to folder where Storybook is built |
| `build-command` | string | | storybook:build | Command to build Storybook with |
| `use-prebuilt-package` | string | | false | If a prebuilt Storybook package should be used |
| `use-prebuilt-image` | string | | false | If a prebuilt Storybook Docker image should be used |
| `jenkins-folder-name` | string | | | Jenkins folder where the deployment jobs are located |
| `generate-types-command` | string | | false | Command to generate gql types |
| `pr-number` | string | | | Event number of the original pr, in case event number or issue number is not present. . |
| `checkout-token` | string | | | Repository checkout access token `GITHUB_TOKEN`. Required for self hosted runners |
| name | type | required | default | description |
| ------------------------ | ------------------------------------------ | -------- | ------------------ | ------------------------------------------------------------------------------------------- |
| `sha` | string || | Commit hash that will be used as a tag for the Docker image |
| `environment` | enum<<br/>`temploy`,<br/>`staging`,<br/>>' || | Environment to deploy Storybook to |
| `env-file` | string | | .env.temploy | `.env` file name from which to read variables. Required for temploy deployment only |
| `davinci-branch` | string | | master | Custom davinci branch |
| `dist-folder` | string | | ./storybook-static | Path to folder where Storybook is built |
| `build-command` | string | | storybook:build | Command to build Storybook with |
| `use-prebuilt-package` | string | | false | If a prebuilt Storybook package should be used |
| `use-prebuilt-image` | string | | false | If a prebuilt Storybook Docker image should be used |
| `jenkins-folder-name` | string | | | Jenkins folder where the deployment jobs are located |
| `generate-types-command` | string | | false | Command to generate gql types |
| `pr-number` | string | | | Event number of the original pr, in case event number or issue number is not present. . |
| `checkout-token` | string | | | Repository checkout access token `GITHUB_TOKEN`. Required for self hosted runners |
| `node-version` | string | | 18 | Node.js version used. The action is guaranteed to work only with Node.js@18 (default value) |

### Outputs

Expand Down
6 changes: 5 additions & 1 deletion deploy-storybook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ inputs:
checkout-token:
description: Repository checkout access token `GITHUB_TOKEN`. Required for self hosted runners
required: false
node-version:
required: false
default: 18
description: 'Node.js version used. The action is guaranteed to work only with Node.js@18 (default value)'

runs:
using: composite
steps:
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: ${{ inputs.node-version }}

- name: Install Dependencies
if: ${{ inputs.use-prebuilt-package == 'false' && inputs.use-prebuilt-image == 'false' }}
Expand Down
6 changes: 5 additions & 1 deletion report-affected-packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Generate a diagram of affected monorepo packages. Works with worksflows triggere

### Inputs

Not specified
The list of arguments, that are used in GH Action:

| name | type | required | default | description |
| -------------- | ------ | -------- | ------- | ------------------------------------------------------------------------------------------- |
| `node-version` | string | | 18 | Node.js version used. The action is guaranteed to work only with Node.js@18 (default value) |

### Outputs

Expand Down
8 changes: 7 additions & 1 deletion report-affected-packages/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: 'Report affected packages'
description: 'Generate a diagram of affected monorepo packages as a job summary. Works with workflows triggered by pull_request event.'

inputs:
node-version:
required: false
default: 18
description: 'Node.js version used. The action is guaranteed to work only with Node.js@18 (default value)'

runs:
using: 'composite'
steps:
- uses: actions/[email protected]
with:
node-version: 18
node-version: ${{ inputs.node-version }}

- uses: masesgroup/retrieve-changed-files@2e42889ff54e0810cf088f73a38a2db5a9d0684f
id: files
Expand Down

0 comments on commit 711fad8

Please sign in to comment.