From f7bc5aea8ada122ae37c9c569ed1b6da900868df Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 22 Apr 2021 07:14:00 +0200 Subject: [PATCH 1/5] build: update release workflow --- .github/workflows/build.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 144292f75b8d89..704c10ec1a556f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,14 +5,22 @@ on: branches: - master - v24 + - v23 workflow_dispatch: + inputs: + dryRun: + description: 'Dry-Run' + default: 'false' env: + # Currently no way to detect automatically (#8153) + DEFAULT_BRANCH: master YARN_MODULES_CACHE_KEY: v1 YARN_PACKAGE_CACHE_KEY: v1 YARN_CACHE_FOLDER: .cache/yarn NODE_VERSION: 14 + DRY_RUN: true jobs: test: @@ -179,6 +187,16 @@ jobs: yarn config set version-git-tag false npm config set scripts-prepend-node-path true + - name: Check dry run + run: | + if [[ "${{github.event_name}}" == "workflow_dispatch" && "${{ github.event.inputs.dryRun }}" != "true" ]]; then + echo "DRY_RUN=false" >> $GITHUB_ENV + elif [[ "${{github.ref}}" == "refs/heads/${{env.DEFAULT_BRANCH}}" ]]; then + echo "DRY_RUN=false" >> $GITHUB_ENV + elif [[ "${{github.ref}}" =~ ^refs/heads/v[0-9]+(\.[0-9]+)?$ ]]; then + echo "DRY_RUN=false" >> $GITHUB_ENV + fi + # full checkout for semantic-release - uses: actions/checkout@v2.3.4 with: @@ -193,11 +211,12 @@ jobs: - name: Installing dependencies run: yarn install --frozen-lockfile + # TODO: remove dry-run echo and replace true with env - name: semantic-release - if: github.ref == 'refs/heads/master' run: | + echo "DRY_RUN: ${DRY_RUN}" echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc - npx semantic-release --dry-run ${{github.ref != 'refs/heads/master'}} --ci ${{github.ref == 'refs/heads/master'}} + npx semantic-release --dry-run true env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 2d813adf5f68a738c025a1bc6d7b3a26da4bdbb4 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 22 Apr 2021 07:21:35 +0200 Subject: [PATCH 2/5] chore: disable tests for speedup testing --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 704c10ec1a556f..640a2b579381e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,12 +99,13 @@ jobs: - name: Installing dependencies run: yarn install --frozen-lockfile - - name: Unit tests - run: yarn jest --logHeapUsage --maxWorkers=2 --ci --coverage ${{ env.coverage }} + # TODO: reenable afzer testing + # - name: Unit tests + # run: yarn jest --logHeapUsage --maxWorkers=2 --ci --coverage ${{ env.coverage }} - - name: Codecov - uses: codecov/codecov-action@v1.4.1 - if: always() && env.coverage == 'true' + # - name: Codecov + # uses: codecov/codecov-action@v1.4.1 + # if: always() && env.coverage == 'true' # build after tests to exclude files - name: Build From 4ff0c23024e6e69dfe0cdbc61bc5b21fa4341870 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 22 Apr 2021 07:51:27 +0200 Subject: [PATCH 3/5] chore: remove debug stuff --- .github/workflows/build.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 640a2b579381e6..3dd990856eca61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,6 @@ on: branches: - master - v24 - - v23 workflow_dispatch: inputs: @@ -99,15 +98,15 @@ jobs: - name: Installing dependencies run: yarn install --frozen-lockfile - # TODO: reenable afzer testing - # - name: Unit tests - # run: yarn jest --logHeapUsage --maxWorkers=2 --ci --coverage ${{ env.coverage }} + - name: Unit tests + run: yarn jest --logHeapUsage --maxWorkers=2 --ci --coverage ${{ env.coverage }} - # - name: Codecov - # uses: codecov/codecov-action@v1.4.1 - # if: always() && env.coverage == 'true' + - name: Codecov + uses: codecov/codecov-action@v1.4.1 + if: always() && env.coverage == 'true' - # build after tests to exclude files + # build after tests to exclude build files from tests + # TODO: check if build before test speeds up tests - name: Build run: yarn build @@ -212,12 +211,10 @@ jobs: - name: Installing dependencies run: yarn install --frozen-lockfile - # TODO: remove dry-run echo and replace true with env - name: semantic-release run: | - echo "DRY_RUN: ${DRY_RUN}" echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc - npx semantic-release --dry-run true + npx semantic-release --dry-run ${{env.DRY_RUN}} env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 08ad8e5abdaf38dfc629bd6933df4b3ee370edd7 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 22 Apr 2021 07:57:01 +0200 Subject: [PATCH 4/5] chore: use dry-run by default --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dd990856eca61..7dccfacde6a1bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ on: inputs: dryRun: description: 'Dry-Run' - default: 'false' + default: 'true' env: # Currently no way to detect automatically (#8153) From 211faa5002594e77989db7b889bdc954b014f201 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 22 Apr 2021 08:08:12 +0200 Subject: [PATCH 5/5] chore: allow manual npm release --- .github/workflows/release-npm.yml | 37 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index b7286c4738e7dd..c718fb45dc9d5b 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -1,13 +1,29 @@ name: release-npm + on: repository_dispatch: types: [renovate-release] + workflow_dispatch: + inputs: + sha: + description: 'Git sha to checkout' + required: true + version: + description: 'Version to release' + required: true + tag: + description: 'Npm dist-tag' + default: 'latest' + env: YARN_MODULES_CACHE_KEY: v1 YARN_PACKAGE_CACHE_KEY: v1 YARN_CACHE_FOLDER: .cache/yarn NODE_VERSION: 14 + GIT_SHA: ${{ github.event.client_payload.sha }} + NPM_VERSION: ${{ github.event.client_payload.version }} + NPM_TAG: ${{ github.event.client_payload.tag }} jobs: release-npm: @@ -27,9 +43,17 @@ jobs: yarn config set version-git-tag false npm config set scripts-prepend-node-path true + - name: Prepare env + run: | + if [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then + echo "GIT_SHA=${{ github.event.inputs.sha }}" >> $GITHUB_ENV + echo "NPM_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV + echo "NPM_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV + fi + - uses: actions/checkout@v2.3.4 with: - ref: ${{ github.event.client_payload.sha }} + ref: ${{ env.GIT_SHA }} - name: Cache Yarn packages id: yarn_cache_packages @@ -41,17 +65,16 @@ jobs: - name: Installing dependencies run: yarn install --frozen-lockfile - - name: Build ${{ github.event.client_payload.version }} + - name: Build ${{ env.NPM_VERSION }} run: yarn build - - name: Prepare ${{ github.event.client_payload.version }} + - name: Prepare ${{ env.NPM_VERSION }} run: | - npm --no-git-tag-version version ${{ github.event.client_payload.version }} + npm --no-git-tag-version version ${{ env.NPM_VERSION }} - - name: Publish ${{ github.event.client_payload.version }} + - name: Publish ${{ env.NPM_VERSION }} run: | echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc - npm publish --tag ${TAG:-latest} + npm publish --tag ${NPM_TAG:-latest} env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG: ${{ github.event.client_payload.tag }}