From dbe884b7d113c09c5d7d3377faeeb5c4cc7c9e72 Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 18:11:31 +0100 Subject: [PATCH 1/7] Add node-version parameters --- build-publish-alpha-package/README.md | 11 ++++++----- build-publish-alpha-package/action.yml | 6 +++++- build-push-image/README.md | 17 +++++++++-------- build-push-image/action.yml | 6 +++++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/build-publish-alpha-package/README.md b/build-publish-alpha-package/README.md index 84203e03..09373cd7 100644 --- a/build-publish-alpha-package/README.md +++ b/build-publish-alpha-package/README.md @@ -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 diff --git a/build-publish-alpha-package/action.yml b/build-publish-alpha-package/action.yml index 911b06ba..63ca51ee 100644 --- a/build-publish-alpha-package/action.yml +++ b/build-publish-alpha-package/action.yml @@ -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 @@ -29,7 +33,7 @@ runs: - name: Setup node uses: actions/setup-node@v3.2.0 with: - node-version: 18 + node-version: ${{ inputs.node-version }} - uses: toptal/davinci-github-actions/yarn-install@v6.0.0 diff --git a/build-push-image/README.md b/build-push-image/README.md index 076d4ecb..bf85459e 100644 --- a/build-push-image/README.md +++ b/build-push-image/README.md @@ -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<
`temploy`,
`staging`,
`production`,
> | | 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<
`temploy`,
`staging`,
`production`,
> | | 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 diff --git a/build-push-image/action.yml b/build-push-image/action.yml index 58cd2b0d..a07f31f1 100644 --- a/build-push-image/action.yml +++ b/build-push-image/action.yml @@ -28,6 +28,10 @@ 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 @@ -43,7 +47,7 @@ runs: - name: Setup node uses: actions/setup-node@v3.2.0 with: - node-version: 18 + node-version: ${{ inputs.node-version }} - id: meta-latest shell: bash From 1b34e34b3332e13477dc23baa4a33a6367b9fcfb Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 18:31:19 +0100 Subject: [PATCH 2/7] Add test code --- build-push-image/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-push-image/action.yml b/build-push-image/action.yml index a07f31f1..bf7c5b14 100644 --- a/build-push-image/action.yml +++ b/build-push-image/action.yml @@ -49,6 +49,10 @@ runs: with: node-version: ${{ inputs.node-version }} + # TODO: remove before merge + - name: Check version + run: yarn node --version + - id: meta-latest shell: bash env: From c692c78b86115141f3f954045745eb07ce2ad855 Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 18:37:47 +0100 Subject: [PATCH 3/7] Add test code --- build-push-image/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/build-push-image/action.yml b/build-push-image/action.yml index bf7c5b14..8c22032c 100644 --- a/build-push-image/action.yml +++ b/build-push-image/action.yml @@ -51,6 +51,7 @@ runs: # TODO: remove before merge - name: Check version + shell: bash run: yarn node --version - id: meta-latest From a58791d48b509e1218e29f6c541804178161824d Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 18:44:21 +0100 Subject: [PATCH 4/7] Update --- deploy-storybook/README.md | 29 +++++++++++++++-------------- deploy-storybook/action.yml | 6 +++++- report-affected-packages/README.md | 6 +++++- report-affected-packages/action.yml | 8 +++++++- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/deploy-storybook/README.md b/deploy-storybook/README.md index dfa13e7b..75653927 100644 --- a/deploy-storybook/README.md +++ b/deploy-storybook/README.md @@ -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<
`temploy`,
`staging`,
>' | ✅ | | 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<
`temploy`,
`staging`,
>' | ✅ | | 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 diff --git a/deploy-storybook/action.yml b/deploy-storybook/action.yml index b44ff42a..bcc2e218 100644 --- a/deploy-storybook/action.yml +++ b/deploy-storybook/action.yml @@ -54,6 +54,10 @@ 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 @@ -61,7 +65,7 @@ runs: - 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' }} diff --git a/report-affected-packages/README.md b/report-affected-packages/README.md index 04f420d5..a3421008 100644 --- a/report-affected-packages/README.md +++ b/report-affected-packages/README.md @@ -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 diff --git a/report-affected-packages/action.yml b/report-affected-packages/action.yml index 52142f2d..dee5af6c 100644 --- a/report-affected-packages/action.yml +++ b/report-affected-packages/action.yml @@ -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/setup-node@v3.2.0 with: - node-version: 18 + node-version: ${{ inputs.node-version }} - uses: masesgroup/retrieve-changed-files@2e42889ff54e0810cf088f73a38a2db5a9d0684f id: files From 954dcb441174628bda89d37b5ce18f222a27ee12 Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 18:58:15 +0100 Subject: [PATCH 5/7] Add changeset --- .changeset/funny-cameras-doubt.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/funny-cameras-doubt.md diff --git a/.changeset/funny-cameras-doubt.md b/.changeset/funny-cameras-doubt.md new file mode 100644 index 00000000..f17268c5 --- /dev/null +++ b/.changeset/funny-cameras-doubt.md @@ -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`) From d01bad91af546b7f02d974620ea1f6d28f2c6309 Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Fri, 17 Nov 2023 19:04:20 +0100 Subject: [PATCH 6/7] Add minor fixes --- .github/workflows/pr-checks.yml | 2 +- .github/workflows/release.yml | 2 +- build-publish-alpha-package/action.yml | 2 +- build-push-image/action.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 4be4a670..e02470b2 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -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/setup-node@v3.8.1 with: node-version: 18 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82ec292d..9807fe61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/setup-node@v3.8.1 with: node-version: 18 diff --git a/build-publish-alpha-package/action.yml b/build-publish-alpha-package/action.yml index 63ca51ee..c01af50a 100644 --- a/build-publish-alpha-package/action.yml +++ b/build-publish-alpha-package/action.yml @@ -30,7 +30,7 @@ runs: run: | npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN" - - name: Setup node + - name: Set up node uses: actions/setup-node@v3.2.0 with: node-version: ${{ inputs.node-version }} diff --git a/build-push-image/action.yml b/build-push-image/action.yml index 8c22032c..0b3c47be 100644 --- a/build-push-image/action.yml +++ b/build-push-image/action.yml @@ -36,7 +36,7 @@ inputs: runs: using: composite steps: - - name: Checkout davinci + - name: Check out davinci uses: actions/checkout@v3 with: repository: toptal/davinci @@ -44,7 +44,7 @@ runs: path: davinci ref: ${{ inputs.davinci-branch }} - - name: Setup node + - name: Set up node uses: actions/setup-node@v3.2.0 with: node-version: ${{ inputs.node-version }} From 4fb4230c4f116ff78e43b5c56416164fa194d973 Mon Sep 17 00:00:00 2001 From: Aleksandr Shumilov Date: Mon, 20 Nov 2023 15:44:27 +0100 Subject: [PATCH 7/7] Remove temp changes --- build-push-image/action.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build-push-image/action.yml b/build-push-image/action.yml index 0b3c47be..74821cf2 100644 --- a/build-push-image/action.yml +++ b/build-push-image/action.yml @@ -49,11 +49,6 @@ runs: with: node-version: ${{ inputs.node-version }} - # TODO: remove before merge - - name: Check version - shell: bash - run: yarn node --version - - id: meta-latest shell: bash env: