From c05b0a440b096f2d1751ca9f4c58f2cbe2749a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 25 May 2022 15:28:26 +0200 Subject: [PATCH 1/2] fix(scripts): netlify build and artifacts order --- .github/actions/restore-artifacts/action.yml | 12 +++++++++++ .github/workflows/check.yml | 21 +++++++++++++++----- netlify.toml | 2 +- scripts/website/netlify-ignore-build.sh | 7 +++++++ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100755 scripts/website/netlify-ignore-build.sh diff --git a/.github/actions/restore-artifacts/action.yml b/.github/actions/restore-artifacts/action.yml index b1b4e6b3c33..761c19dc257 100644 --- a/.github/actions/restore-artifacts/action.yml +++ b/.github/actions/restore-artifacts/action.yml @@ -52,6 +52,18 @@ runs: name: client-javascript-utils-requester-node-http path: clients/algoliasearch-client-javascript/packages/requester-node-http/ + - name: Download client-javascript-algoliasearch artifact + if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} + uses: actions/download-artifact@v3 + with: + name: client-javascript-algoliasearch + path: clients/algoliasearch-client-javascript/packages/algoliasearch/ + + - name: Unzip client-javascript-algoliasearch artifact + if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} + shell: bash + run: unzip -q -o client-javascript-algoliasearch.zip && rm clients-javascript-algoliasearch.zip + # JavaScript - name: Download clients-javascript artifact if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cddd95fedee..4fee087acdd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -288,12 +288,23 @@ jobs: if: ${{ steps.cache.outputs.cache-hit != 'true' }} run: yarn cli build clients javascript algoliasearch + - name: Zip artifact before storing + run: zip -r -y client-javascript-algoliasearch.zip clients/algoliasearch-client-javascript/packages/algoliasearch/ -x "**/node_modules/**" "**/node_modules/.**" "clients/algoliasearch-client-javascript/.yarn/**" + + - name: Store JavaScript 'algoliasearch' client + uses: actions/upload-artifact@v3 + with: + if-no-files-found: error + name: client-javascript-algoliasearch + path: client-javascript-algoliasearch.zip + codegen: runs-on: ubuntu-20.04 timeout-minutes: 10 needs: - setup - client_gen + - client_javascript_algoliasearch if: | always() && !contains(needs.*.result, 'cancelled') && @@ -305,11 +316,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.TOKEN_GENERATE_BOT }} - - name: Setup - uses: ./.github/actions/setup - with: - type: minimal - - name: Download all artifacts if: ${{ needs.setup.outputs.RUN_CODEGEN == 'true' }} uses: ./.github/actions/restore-artifacts @@ -319,6 +325,11 @@ jobs: php: ${{ needs.setup.outputs.RUN_GEN_PHP }} java: ${{ needs.setup.outputs.RUN_GEN_JAVA }} + - name: Setup + uses: ./.github/actions/setup + with: + type: minimal + - name: Push generated code id: pushGeneratedCode run: yarn workspace scripts pushGeneratedCode diff --git a/netlify.toml b/netlify.toml index 8f1b035b456..4f85e996433 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,7 +1,7 @@ [build] command="BUNDLE_WITH_DOC=true DOCKER=true yarn cli build specs all && yarn website:build" publish="website/build" - ignore="git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- website/ specs/" + ignore="bash ./scripts/website/netlify-ignore-build.sh" [build.environment] YARN_VERSION = "3.1.1" diff --git a/scripts/website/netlify-ignore-build.sh b/scripts/website/netlify-ignore-build.sh new file mode 100755 index 00000000000..95afbea8195 --- /dev/null +++ b/scripts/website/netlify-ignore-build.sh @@ -0,0 +1,7 @@ +# This $BRANCH variable comes from the Netlify env +if [[ $BRANCH == chore/prepare-release-* ]] ; +then + exit 0 +else + git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- website/ specs/ && exit $? +fi From 724667aac4668c0c5eed362d27a33c9f464fd05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 25 May 2022 15:50:08 +0200 Subject: [PATCH 2/2] fix artifact path --- .github/actions/restore-artifacts/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/restore-artifacts/action.yml b/.github/actions/restore-artifacts/action.yml index 761c19dc257..48476c1ddc9 100644 --- a/.github/actions/restore-artifacts/action.yml +++ b/.github/actions/restore-artifacts/action.yml @@ -52,19 +52,18 @@ runs: name: client-javascript-utils-requester-node-http path: clients/algoliasearch-client-javascript/packages/requester-node-http/ + # JavaScript - name: Download client-javascript-algoliasearch artifact if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} uses: actions/download-artifact@v3 with: name: client-javascript-algoliasearch - path: clients/algoliasearch-client-javascript/packages/algoliasearch/ - name: Unzip client-javascript-algoliasearch artifact if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} shell: bash - run: unzip -q -o client-javascript-algoliasearch.zip && rm clients-javascript-algoliasearch.zip + run: unzip -q -o client-javascript-algoliasearch.zip && rm client-javascript-algoliasearch.zip - # JavaScript - name: Download clients-javascript artifact if: ${{ inputs.javascript == 'true' && inputs.type == 'all' }} uses: actions/download-artifact@v3