From f82634f1408626a4a5f60112b0a025c59ecb9512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:13:16 +0100 Subject: [PATCH 01/30] test workflow --- .github/workflows/main.yml | 34 ++++++++++++++++------------------ .nvmrc | 1 + 2 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b1d6bab..1124c41b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,13 +4,11 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - uses: actions/setup-node@v4 with: - version: 8.2.0 - - uses: actions/setup-node@v3 - with: - node-version: 18 + node-version-file: ".nvmrc" cache: pnpm - name: Install dependencies run: pnpm install @@ -20,20 +18,18 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - with: - version: 8.2.0 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version-file: ".nvmrc" cache: "pnpm" - name: Install dependencies run: pnpm install - name: Test run: pnpm test:ci - name: Generate coverage report - uses: irongut/CodeCoverageSummary@v1.3.0 + uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 if: ${{ github.actor != 'dependabot[bot]' }} with: filename: coverage/cobertura-coverage.xml @@ -41,7 +37,7 @@ jobs: output: file - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} with: recreate: true @@ -50,11 +46,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version-file: ".nvmrc" cache: pnpm - uses: actions/cache@v3 with: @@ -68,6 +64,8 @@ jobs: run: pnpm install - name: Build project run: pnpm build + - name: Check for changeset + run: pnpm exec changeset status --since=main - name: Creating .npmrc if: ${{ github.actor != 'dependabot[bot]' }} run: | diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3c032078 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 From 090abc5ec6f520033a5115c572ae5c7789a0e6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:30:52 +0100 Subject: [PATCH 02/30] use full depth --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1124c41b..5b8d1101 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - uses: actions/setup-node@v4 with: From 25d06f934f76115d420376dee2ca6d3d62280654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:32:48 +0100 Subject: [PATCH 03/30] use full depth --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b8d1101..4543cd87 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: QA on: [pull_request] jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 @@ -16,11 +16,9 @@ jobs: run: pnpm lint test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - uses: actions/setup-node@v4 with: @@ -46,9 +44,11 @@ jobs: path: code-coverage-results.md build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - uses: actions/setup-node@v4 with: From 21684550fc9236d1e8a5ab8ffe9c44aa0d28aac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:36:12 +0100 Subject: [PATCH 04/30] use orign main --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4543cd87..66552221 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,7 @@ jobs: with: node-version-file: ".nvmrc" cache: pnpm - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ${{ github.workspace }}/.next/cache @@ -67,7 +67,7 @@ jobs: - name: Build project run: pnpm build - name: Check for changeset - run: pnpm exec changeset status --since=main + run: pnpm exec changeset status --since origin/main - name: Creating .npmrc if: ${{ github.actor != 'dependabot[bot]' }} run: | From 1c41d387e9dcf5d89f8bf79b5a22772c44865e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:48:25 +0100 Subject: [PATCH 05/30] add echo --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66552221..58e540bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,7 +67,11 @@ jobs: - name: Build project run: pnpm build - name: Check for changeset - run: pnpm exec changeset status --since origin/main + id: changeset-check + run: | + HAS_CHANGESETS=$(pnpm exec changeset status --since origin/main) + echo "$HAS_CHANGESETS" + echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc if: ${{ github.actor != 'dependabot[bot]' }} run: | From 8f882892ab06956e27a050ac21a0efeb7dbc3b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:15:50 +0100 Subject: [PATCH 06/30] add has changesets --- .github/workflows/main.yml | 3 ++- .gitignore | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58e540bc..3e59b44e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,8 @@ jobs: - name: Check for changeset id: changeset-check run: | - HAS_CHANGESETS=$(pnpm exec changeset status --since origin/main) + pnpm exec changeset status --since origin/main --output changeset-status.json + HAS_CHANGESETS=$(fromJson(changeset-status.json) | jq -r 'if .changesets | length > 0 then true else false end') echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc diff --git a/.gitignore b/.gitignore index 9e8d0965..2bdf5f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -116,4 +116,7 @@ dist .pnp.* .idea/ -.vscode/ \ No newline at end of file +.vscode/ + +# changeset status +changeset-status.json From ed4173546f961d1780eaa91e0b2ce12c40a07214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:18:58 +0100 Subject: [PATCH 07/30] add cat --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e59b44e..f9683487 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,7 +70,7 @@ jobs: id: changeset-check run: | pnpm exec changeset status --since origin/main --output changeset-status.json - HAS_CHANGESETS=$(fromJson(changeset-status.json) | jq -r 'if .changesets | length > 0 then true else false end') + HAS_CHANGESETS=$(cat ./changeset-status.json | jq -r 'if .changesets | length > 0 then true else false end') echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc From 3b1e336c79550265607155c41acab391a18aa521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:27:43 +0100 Subject: [PATCH 08/30] test --- .github/workflows/main.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9683487..43d0d9a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -67,23 +67,25 @@ jobs: - name: Build project run: pnpm build - name: Check for changeset - id: changeset-check run: | pnpm exec changeset status --since origin/main --output changeset-status.json HAS_CHANGESETS=$(cat ./changeset-status.json | jq -r 'if .changesets | length > 0 then true else false end') echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc - if: ${{ github.actor != 'dependabot[bot]' }} + if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS }} run: | cat << EOF > "$HOME/.npmrc" //registry.npmjs.org/:_authToken=$NPM_TOKEN EOF env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + HAS_CHANGESETS: env.HAS_CHANGESETS - name: Release on @dev tag in npm - if: ${{ github.actor != 'dependabot[bot]' }} + if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS }} run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks + env: + HAS_CHANGESETS: env.HAS_CHANGESETS # Store package.json version in env - run: echo "PACKAGE_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV if: ${{ github.actor != 'dependabot[bot]' }} From 4a4a2be740ae81ccdd0e831bba9f4b27134cdc0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:29:14 +0100 Subject: [PATCH 09/30] test again --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43d0d9a5..363ab87b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} HAS_CHANGESETS: env.HAS_CHANGESETS - name: Release on @dev tag in npm - if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS }} + if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS != 'false' }} run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks env: HAS_CHANGESETS: env.HAS_CHANGESETS From 9f637bc8e96011f83a150242742dbca5d23011db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:30:28 +0100 Subject: [PATCH 10/30] test vol2 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 363ab87b..ebf6b989 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} HAS_CHANGESETS: env.HAS_CHANGESETS - name: Release on @dev tag in npm - if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS != 'false' }} + if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS != 'true' }} run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks env: HAS_CHANGESETS: env.HAS_CHANGESETS From 9f7b1c9bdd125dbb584a6fc63b865cd722d5529a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:31:53 +0100 Subject: [PATCH 11/30] add if --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ebf6b989..accc6ad5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,14 +73,13 @@ jobs: echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc - if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS }} + if: ${{ env.HAS_CHANGESETS }} run: | cat << EOF > "$HOME/.npmrc" //registry.npmjs.org/:_authToken=$NPM_TOKEN EOF env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - HAS_CHANGESETS: env.HAS_CHANGESETS - name: Release on @dev tag in npm if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS != 'true' }} run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks From 1cf48e239b3862be95814b796f2382de7888fb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:34:22 +0100 Subject: [PATCH 12/30] missing changesets --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index accc6ad5..52d30fba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - name: Creating .npmrc - if: ${{ env.HAS_CHANGESETS }} + if: env.HAS_CHANGESETS != 'true' run: | cat << EOF > "$HOME/.npmrc" //registry.npmjs.org/:_authToken=$NPM_TOKEN From 950bb3a5ac959c09fc2cccc7f8b288ab9c510747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:38:07 +0100 Subject: [PATCH 13/30] add echo --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52d30fba..d2d2818e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,8 +70,8 @@ jobs: run: | pnpm exec changeset status --since origin/main --output changeset-status.json HAS_CHANGESETS=$(cat ./changeset-status.json | jq -r 'if .changesets | length > 0 then true else false end') - echo "$HAS_CHANGESETS" echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" + - run: echo "${{ env.HAS_CHANGESETS }}" - name: Creating .npmrc if: env.HAS_CHANGESETS != 'true' run: | From b0acefb623a709d7977d4232980e000716039456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:53:49 +0100 Subject: [PATCH 14/30] from json --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d2d2818e..a9f6b1b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - run: echo "${{ env.HAS_CHANGESETS }}" - name: Creating .npmrc - if: env.HAS_CHANGESETS != 'true' + if: ${{ fromJson(env.HAS_CHANGESETS) != 'true' }} run: | cat << EOF > "$HOME/.npmrc" //registry.npmjs.org/:_authToken=$NPM_TOKEN From e99744d7c7b094be818e614d3017b6f33be987f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:58:30 +0100 Subject: [PATCH 15/30] check if true --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a9f6b1b3..0f5c6517 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - run: echo "${{ env.HAS_CHANGESETS }}" - name: Creating .npmrc - if: ${{ fromJson(env.HAS_CHANGESETS) != 'true' }} + if: env.HAS_CHANGESETS == 'true' run: | cat << EOF > "$HOME/.npmrc" //registry.npmjs.org/:_authToken=$NPM_TOKEN From 1bd53594f058991088c1a8ce5556f242a8d006b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:55:25 +0100 Subject: [PATCH 16/30] add test workflow --- .github/workflows/dev-release.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/main.yml | 24 ++++-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/dev-release.yml diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml new file mode 100644 index 00000000..9d39dfc5 --- /dev/null +++ b/.github/workflows/dev-release.yml @@ -0,0 +1,28 @@ +name: Release @dev tag to npm +on: + push: +jobs: + release: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + with: + run_install: | + - args: [--frozen-lockfile] + - run: pnpm build + - name: Check for changeset + run: | + pnpm exec changeset status --since origin/main + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Release on @dev tag in npm + run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks + - name: Post if error + if: failure() + run: echo "::error file=.changeset,line=11,col=11::Missing changeset" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f5c6517..44b11ee8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,31 +1,16 @@ name: QA on: [pull_request] jobs: - lint: + lint-test: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - - uses: actions/setup-node@v4 with: - node-version-file: ".nvmrc" - cache: pnpm - - name: Install dependencies - run: pnpm install + run_install: | + - args: [--frozen-lockfile] - name: Check linters run: pnpm lint - - test: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "pnpm" - - name: Install dependencies - run: pnpm install - name: Test run: pnpm test:ci - name: Generate coverage report @@ -35,13 +20,12 @@ jobs: filename: coverage/cobertura-coverage.xml format: markdown output: file - - name: Add Coverage PR Comment uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0 if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} with: recreate: true - path: code-coverage-results.md + path: code-coverage-results.md build: runs-on: ubuntu-22.04 From f7487e6c18247fc5d205182f63b26bf92721575b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:57:37 +0100 Subject: [PATCH 17/30] add --- .github/workflows/dev-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 9d39dfc5..c7de5673 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -6,6 +6,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: run_install: | @@ -25,4 +27,4 @@ jobs: run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks - name: Post if error if: failure() - run: echo "::error file=.changeset,line=11,col=11::Missing changeset" + run: echo "::error file=.changeset/README.md,line=11,col=11::Missing changeset" From be9e977cc652b57f484bb830323643f2615c6e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:10:05 +0100 Subject: [PATCH 18/30] test full workflow --- .github/workflows/dev-release.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index c7de5673..814fb5d0 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -1,6 +1,5 @@ name: Release @dev tag to npm -on: - push: +on: [pull_request] jobs: release: runs-on: ubuntu-22.04 @@ -13,6 +12,19 @@ jobs: run_install: | - args: [--frozen-lockfile] - run: pnpm build + - run: | + VERSION=$(cat package.json | jq -r '.version') + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + - uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Released snapshot build with `@dev` tag in npm with version: $VERSION + + Install it with: + ```shell + pnpm add @saleor/app-sdk@$VERSION + ``` - name: Check for changeset run: | pnpm exec changeset status --since origin/main @@ -25,6 +37,3 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Release on @dev tag in npm run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks - - name: Post if error - if: failure() - run: echo "::error file=.changeset/README.md,line=11,col=11::Missing changeset" From 8432e9fdfe0e26093e01a1b9a507ec686bb5ba8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:12:00 +0100 Subject: [PATCH 19/30] add version --- .github/workflows/dev-release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 814fb5d0..9e998ef6 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -16,14 +16,16 @@ jobs: VERSION=$(cat package.json | jq -r '.version') echo "VERSION=$VERSION" >> "$GITHUB_ENV" - uses: peter-evans/create-or-update-comment@v4 + env: + VERSION: ${{ env.VERSION }} with: issue-number: ${{ github.event.pull_request.number }} body: | - Released snapshot build with `@dev` tag in npm with version: $VERSION + Released snapshot build with `@dev` tag in npm with version: `${{ env.VERSION }}`. Install it with: ```shell - pnpm add @saleor/app-sdk@$VERSION + pnpm add @saleor/app-sdk@${{ env.VERSION }} ``` - name: Check for changeset run: | From 732e2679512165ed0ffcb3cf3686947b857bd06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:15:37 +0100 Subject: [PATCH 20/30] update workflows --- .github/workflows/dev-release.yml | 23 ++++++----- .github/workflows/main.yml | 63 +------------------------------ 2 files changed, 12 insertions(+), 74 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 9e998ef6..25e56df3 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -12,6 +12,17 @@ jobs: run_install: | - args: [--frozen-lockfile] - run: pnpm build + - name: Check for changeset + run: pnpm exec changeset status --since origin/main + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Release on @dev tag in npm + run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks - run: | VERSION=$(cat package.json | jq -r '.version') echo "VERSION=$VERSION" >> "$GITHUB_ENV" @@ -27,15 +38,3 @@ jobs: ```shell pnpm add @saleor/app-sdk@${{ env.VERSION }} ``` - - name: Check for changeset - run: | - pnpm exec changeset status --since origin/main - - name: Create .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Release on @dev tag in npm - run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44b11ee8..941a21c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,65 +25,4 @@ jobs: if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} with: recreate: true - path: code-coverage-results.md - - build: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: pnpm - - uses: actions/cache@v4 - with: - path: | - ${{ github.workspace }}/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - # If source files changed but packages didn't, rebuild from a prior cache. - restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}- - - name: Install dependencies - run: pnpm install - - name: Build project - run: pnpm build - - name: Check for changeset - run: | - pnpm exec changeset status --since origin/main --output changeset-status.json - HAS_CHANGESETS=$(cat ./changeset-status.json | jq -r 'if .changesets | length > 0 then true else false end') - echo "HAS_CHANGESETS=$HAS_CHANGESETS" >> "$GITHUB_ENV" - - run: echo "${{ env.HAS_CHANGESETS }}" - - name: Creating .npmrc - if: env.HAS_CHANGESETS == 'true' - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Release on @dev tag in npm - if: ${{ github.actor != 'dependabot[bot]' && env.HAS_CHANGESETS != 'true' }} - run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks - env: - HAS_CHANGESETS: env.HAS_CHANGESETS - # Store package.json version in env - - run: echo "PACKAGE_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV - if: ${{ github.actor != 'dependabot[bot]' }} - - run: echo '${{ fromJson(env.PACKAGE_JSON).version }}' - if: ${{ github.actor != 'dependabot[bot]' }} - # Post a comment with released snapshot - - name: Create with released tag - if: ${{ github.actor != 'dependabot[bot]' }} - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - Released snapshot build with `@dev` tag in npm with version: `${{ fromJson(env.PACKAGE_JSON).version }}` - - Install it with - ```bash - pnpm add @saleor/app-sdk@${{ fromJson(env.PACKAGE_JSON).version }} - ``` + path: code-coverage-results.md From 494120a7a8289d4e95d7c4d73a547e5ec9a6e99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:28:23 +0100 Subject: [PATCH 21/30] update changeset --- package.json | 2 +- pnpm-lock.yaml | 179 +++++++++++++++++++++++-------------------------- 2 files changed, 84 insertions(+), 97 deletions(-) diff --git a/package.json b/package.json index e4796830..57bbc9fb 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "uuid": "9.0.0" }, "devDependencies": { - "@changesets/cli": "2.26.2", + "@changesets/cli": "2.27.1", "@testing-library/dom": "^8.17.1", "@testing-library/react": "^13.4.0", "@types/debug": "^4.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53539fcc..412d3491 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - dependencies: '@opentelemetry/api': specifier: ^1.7.0 @@ -29,8 +25,8 @@ dependencies: devDependencies: '@changesets/cli': - specifier: 2.26.2 - version: 2.26.2 + specifier: 2.27.1 + version: 2.27.1 '@testing-library/dom': specifier: ^8.17.1 version: 8.17.1 @@ -411,14 +407,14 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@changesets/apply-release-plan@6.1.4: - resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} + /@changesets/apply-release-plan@7.0.0: + resolution: {integrity: sha512-vfi69JR416qC9hWmFGSxj7N6wA5J222XNBmezSVATPWDVPIF7gkd4d8CpbEbXmRWbVrkoli3oerGS6dcL/BGsQ==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/config': 2.3.1 - '@changesets/get-version-range-type': 0.3.2 - '@changesets/git': 2.0.0 - '@changesets/types': 5.2.1 + '@changesets/config': 3.0.0 + '@changesets/get-version-range-type': 0.4.0 + '@changesets/git': 3.0.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 detect-indent: 6.1.0 fs-extra: 7.0.1 @@ -429,51 +425,50 @@ packages: semver: 7.5.4 dev: true - /@changesets/assemble-release-plan@5.2.4: - resolution: {integrity: sha512-xJkWX+1/CUaOUWTguXEbCDTyWJFECEhmdtbkjhn5GVBGxdP/JwaHBIU9sW3FR6gD07UwZ7ovpiPclQZs+j+mvg==} + /@changesets/assemble-release-plan@6.0.0: + resolution: {integrity: sha512-4QG7NuisAjisbW4hkLCmGW2lRYdPrKzro+fCtZaILX+3zdUELSvYjpL4GTv0E4aM9Mef3PuIQp89VmHJ4y2bfw==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/types': 5.2.1 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 semver: 7.5.4 dev: true - /@changesets/changelog-git@0.1.14: - resolution: {integrity: sha512-+vRfnKtXVWsDDxGctOfzJsPhaCdXRYoe+KyWYoq5X/GqoISREiat0l3L8B0a453B2B4dfHGcZaGyowHbp9BSaA==} + /@changesets/changelog-git@0.2.0: + resolution: {integrity: sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 dev: true - /@changesets/cli@2.26.2: - resolution: {integrity: sha512-dnWrJTmRR8bCHikJHl9b9HW3gXACCehz4OasrXpMp7sx97ECuBGGNjJhjPhdZNCvMy9mn4BWdplI323IbqsRig==} + /@changesets/cli@2.27.1: + resolution: {integrity: sha512-iJ91xlvRnnrJnELTp4eJJEOPjgpF3NOh4qeQehM6Ugiz9gJPRZ2t+TsXun6E3AMN4hScZKjqVXl0TX+C7AB3ZQ==} hasBin: true dependencies: '@babel/runtime': 7.20.13 - '@changesets/apply-release-plan': 6.1.4 - '@changesets/assemble-release-plan': 5.2.4 - '@changesets/changelog-git': 0.1.14 - '@changesets/config': 2.3.1 - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/get-release-plan': 3.0.17 - '@changesets/git': 2.0.0 - '@changesets/logger': 0.0.5 - '@changesets/pre': 1.0.14 - '@changesets/read': 0.5.9 - '@changesets/types': 5.2.1 - '@changesets/write': 0.2.3 + '@changesets/apply-release-plan': 7.0.0 + '@changesets/assemble-release-plan': 6.0.0 + '@changesets/changelog-git': 0.2.0 + '@changesets/config': 3.0.0 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/get-release-plan': 4.0.0 + '@changesets/git': 3.0.0 + '@changesets/logger': 0.1.0 + '@changesets/pre': 2.0.0 + '@changesets/read': 0.6.0 + '@changesets/types': 6.0.0 + '@changesets/write': 0.3.0 '@manypkg/get-packages': 1.1.3 - '@types/is-ci': 3.0.0 '@types/semver': 7.5.0 ansi-colors: 4.1.3 chalk: 2.4.2 + ci-info: 3.9.0 enquirer: 2.3.6 external-editor: 3.1.0 fs-extra: 7.0.1 human-id: 1.0.2 - is-ci: 3.0.1 meow: 6.1.1 outdent: 0.5.0 p-limit: 2.3.0 @@ -485,93 +480,93 @@ packages: tty-table: 4.1.6 dev: true - /@changesets/config@2.3.1: - resolution: {integrity: sha512-PQXaJl82CfIXddUOppj4zWu+987GCw2M+eQcOepxN5s+kvnsZOwjEJO3DH9eVy+OP6Pg/KFEWdsECFEYTtbg6w==} + /@changesets/config@3.0.0: + resolution: {integrity: sha512-o/rwLNnAo/+j9Yvw9mkBQOZySDYyOr/q+wptRLcAVGlU6djOeP9v1nlalbL9MFsobuBVQbZCTp+dIzdq+CLQUA==} dependencies: - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/logger': 0.0.5 - '@changesets/types': 5.2.1 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/logger': 0.1.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 micromatch: 4.0.5 dev: true - /@changesets/errors@0.1.4: - resolution: {integrity: sha512-HAcqPF7snsUJ/QzkWoKfRfXushHTu+K5KZLJWPb34s4eCZShIf8BFO3fwq6KU8+G7L5KdtN2BzQAXOSXEyiY9Q==} + /@changesets/errors@0.2.0: + resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} dependencies: extendable-error: 0.1.7 dev: true - /@changesets/get-dependents-graph@1.3.6: - resolution: {integrity: sha512-Q/sLgBANmkvUm09GgRsAvEtY3p1/5OCzgBE5vX3vgb5CvW0j7CEljocx5oPXeQSNph6FXulJlXV3Re/v3K3P3Q==} + /@changesets/get-dependents-graph@2.0.0: + resolution: {integrity: sha512-cafUXponivK4vBgZ3yLu944mTvam06XEn2IZGjjKc0antpenkYANXiiE6GExV/yKdsCnE8dXVZ25yGqLYZmScA==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 chalk: 2.4.2 fs-extra: 7.0.1 semver: 7.5.4 dev: true - /@changesets/get-release-plan@3.0.17: - resolution: {integrity: sha512-6IwKTubNEgoOZwDontYc2x2cWXfr6IKxP3IhKeK+WjyD6y3M4Gl/jdQvBw+m/5zWILSOCAaGLu2ZF6Q+WiPniw==} + /@changesets/get-release-plan@4.0.0: + resolution: {integrity: sha512-9L9xCUeD/Tb6L/oKmpm8nyzsOzhdNBBbt/ZNcjynbHC07WW4E1eX8NMGC5g5SbM5z/V+MOrYsJ4lRW41GCbg3w==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/assemble-release-plan': 5.2.4 - '@changesets/config': 2.3.1 - '@changesets/pre': 1.0.14 - '@changesets/read': 0.5.9 - '@changesets/types': 5.2.1 + '@changesets/assemble-release-plan': 6.0.0 + '@changesets/config': 3.0.0 + '@changesets/pre': 2.0.0 + '@changesets/read': 0.6.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 dev: true - /@changesets/get-version-range-type@0.3.2: - resolution: {integrity: sha512-SVqwYs5pULYjYT4op21F2pVbcrca4qA/bAA3FmFXKMN7Y+HcO8sbZUTx3TAy2VXulP2FACd1aC7f2nTuqSPbqg==} + /@changesets/get-version-range-type@0.4.0: + resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} dev: true - /@changesets/git@2.0.0: - resolution: {integrity: sha512-enUVEWbiqUTxqSnmesyJGWfzd51PY4H7mH9yUw0hPVpZBJ6tQZFMU3F3mT/t9OJ/GjyiM4770i+sehAn6ymx6A==} + /@changesets/git@3.0.0: + resolution: {integrity: sha512-vvhnZDHe2eiBNRFHEgMiGd2CT+164dfYyrJDhwwxTVD/OW0FUD6G7+4DIx1dNwkwjHyzisxGAU96q0sVNBns0w==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.1 + '@changesets/errors': 0.2.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 is-subdir: 1.2.0 micromatch: 4.0.5 spawndamnit: 2.0.0 dev: true - /@changesets/logger@0.0.5: - resolution: {integrity: sha512-gJyZHomu8nASHpaANzc6bkQMO9gU/ib20lqew1rVx753FOxffnCrJlGIeQVxNWCqM+o6OOleCo/ivL8UAO5iFw==} + /@changesets/logger@0.1.0: + resolution: {integrity: sha512-pBrJm4CQm9VqFVwWnSqKEfsS2ESnwqwH+xR7jETxIErZcfd1u2zBSqrHbRHR7xjhSgep9x2PSKFKY//FAshA3g==} dependencies: chalk: 2.4.2 dev: true - /@changesets/parse@0.3.16: - resolution: {integrity: sha512-127JKNd167ayAuBjUggZBkmDS5fIKsthnr9jr6bdnuUljroiERW7FBTDNnNVyJ4l69PzR57pk6mXQdtJyBCJKg==} + /@changesets/parse@0.4.0: + resolution: {integrity: sha512-TS/9KG2CdGXS27S+QxbZXgr8uPsP4yNJYb4BC2/NeFUj80Rni3TeD2qwWmabymxmrLo7JEsytXH1FbpKTbvivw==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 js-yaml: 3.14.1 dev: true - /@changesets/pre@1.0.14: - resolution: {integrity: sha512-dTsHmxQWEQekHYHbg+M1mDVYFvegDh9j/kySNuDKdylwfMEevTeDouR7IfHNyVodxZXu17sXoJuf2D0vi55FHQ==} + /@changesets/pre@2.0.0: + resolution: {integrity: sha512-HLTNYX/A4jZxc+Sq8D1AMBsv+1qD6rmmJtjsCJa/9MSRybdxh0mjbTvE6JYZQ/ZiQ0mMlDOlGPXTm9KLTU3jyw==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.1 + '@changesets/errors': 0.2.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 dev: true - /@changesets/read@0.5.9: - resolution: {integrity: sha512-T8BJ6JS6j1gfO1HFq50kU3qawYxa4NTbI/ASNVVCBTsKquy2HYwM9r7ZnzkiMe8IEObAJtUVGSrePCOxAK2haQ==} + /@changesets/read@0.6.0: + resolution: {integrity: sha512-ZypqX8+/im1Fm98K4YcZtmLKgjs1kDQ5zHpc2U1qdtNBmZZfo/IBiG162RoP0CUF05tvp2y4IspH11PLnPxuuw==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/git': 2.0.0 - '@changesets/logger': 0.0.5 - '@changesets/parse': 0.3.16 - '@changesets/types': 5.2.1 + '@changesets/git': 3.0.0 + '@changesets/logger': 0.1.0 + '@changesets/parse': 0.4.0 + '@changesets/types': 6.0.0 chalk: 2.4.2 fs-extra: 7.0.1 p-filter: 2.1.0 @@ -581,15 +576,15 @@ packages: resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} dev: true - /@changesets/types@5.2.1: - resolution: {integrity: sha512-myLfHbVOqaq9UtUKqR/nZA/OY7xFjQMdfgfqeZIBK4d0hA6pgxArvdv8M+6NUzzBsjWLOtvApv8YHr4qM+Kpfg==} + /@changesets/types@6.0.0: + resolution: {integrity: sha512-b1UkfNulgKoWfqyHtzKS5fOZYSJO+77adgL7DLRDr+/7jhChN+QcHnbjiQVOz/U+Ts3PGNySq7diAItzDgugfQ==} dev: true - /@changesets/write@0.2.3: - resolution: {integrity: sha512-Dbamr7AIMvslKnNYsLFafaVORx4H0pvCA2MHqgtNCySMe1blImEyAEOzDmcgKAkgz4+uwoLz7demIrX+JBr/Xw==} + /@changesets/write@0.3.0: + resolution: {integrity: sha512-slGLb21fxZVUYbyea+94uFiD6ntQW0M2hIKNznFizDhZPDgn2c/fv1UzzlW43RVzh1BEDuIqW6hzlJ1OflNmcw==} dependencies: '@babel/runtime': 7.20.13 - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 fs-extra: 7.0.1 human-id: 1.0.2 prettier: 2.7.1 @@ -1138,12 +1133,6 @@ packages: '@types/ms': 0.7.31 dev: true - /@types/is-ci@3.0.0: - resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} - dependencies: - ci-info: 3.3.2 - dev: true - /@types/istanbul-lib-coverage@2.0.4: resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} dev: true @@ -1805,8 +1794,9 @@ packages: fsevents: 2.3.2 dev: true - /ci-info@3.3.2: - resolution: {integrity: sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==} + /ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} dev: true /clean-publish@4.0.1: @@ -3591,13 +3581,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-ci@3.0.1: - resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} - hasBin: true - dependencies: - ci-info: 3.3.2 - dev: true - /is-core-module@2.10.0: resolution: {integrity: sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==} dependencies: @@ -6131,3 +6114,7 @@ packages: dev: false publishDirectory: dist + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false From d4bd87744d979bf230c481811a10f68aacce8bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:08:01 +0100 Subject: [PATCH 22/30] add dev release --- .github/workflows/dev-release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 25e56df3..9a724647 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -1,7 +1,11 @@ name: Release @dev tag to npm -on: [pull_request] +on: + pull_request: + types: [labeled] + jobs: release: + if: ${{ contains(github.event.pull_request.labels.*.name, 'release dev tag') }} runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -26,7 +30,7 @@ jobs: - run: | VERSION=$(cat package.json | jq -r '.version') echo "VERSION=$VERSION" >> "$GITHUB_ENV" - - uses: peter-evans/create-or-update-comment@v4 + - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 env: VERSION: ${{ env.VERSION }} with: From bbc784c567a8ba8c2eaf130f1125d4aa1dc87d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:15:28 +0100 Subject: [PATCH 23/30] update workflows --- .github/workflows/assign-pr.yml | 4 ++-- .github/workflows/prepare-release.yml | 28 ++++++++++----------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/assign-pr.yml b/.github/workflows/assign-pr.yml index 1df69f2b..37b228b4 100644 --- a/.github/workflows/assign-pr.yml +++ b/.github/workflows/assign-pr.yml @@ -7,9 +7,9 @@ on: jobs: assign_creator: if: ${{ github.actor != 'dependabot[bot]' }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Assign PR to creator - uses: thomaseizinger/assign-pr-creator-action@v1.0.0 + uses: toshimaru/auto-author-assign@ebd30f10fb56e46eb0759a14951f36991426fed0 # v2.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 8866912d..b45f12c5 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -7,34 +7,26 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} -# -# TODO -# - Add tags for each app (e.g. search@3.0.1) for easier parsing -# - Print versions name to commit, for easier Vercel deployments -# jobs: release: name: Prepare release with Changesets - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout Repo - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 # Use version from package.json - - name: Setup Node.js 16 # It was default for Changesets action, check if it can be bumped to v18 - uses: actions/setup-node@v3 + uses: actions/checkout@v4 with: - node-version: 16 - - uses: pnpm/action-setup@v2 - name: Install pnpm - - run: pnpm install - # TODO -> publish to npm as pre-release https://github.com/changesets/changesets/blob/8447c677a37d1d23858059e0ce2b5cd98f4c24ae/docs/snapshot-releases.md + token: ${{ secrets.PAT }} + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + with: + run_install: | + - args: [--frozen-lockfile] - name: Create Release Pull Request - uses: changesets/action@v1 - id: changesets + uses: changesets/action@e2f8e964d080ae97c874b19e27b12e0a8620fb6c # v1.4.6 with: title: Release to npm commit: Release to npm publish: "pnpm publish:ci" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Use private access token so Github can trigger another workflow from this one + GITHUB_TOKEN: ${{ secrets.PAT }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 2dc90eefe10fa59530531309a162f284d6231772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:16:08 +0100 Subject: [PATCH 24/30] test workflow --- .changeset/eight-spoons-lie.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eight-spoons-lie.md diff --git a/.changeset/eight-spoons-lie.md b/.changeset/eight-spoons-lie.md new file mode 100644 index 00000000..067663d9 --- /dev/null +++ b/.changeset/eight-spoons-lie.md @@ -0,0 +1,5 @@ +--- +"@saleor/app-sdk": patch +--- + +Test workflow From 0f3a3c99aab23e5dc572122168fd1cf281cd1d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:20:35 +0100 Subject: [PATCH 25/30] last touches --- .github/workflows/dev-release.yml | 12 ++++++++---- .github/workflows/main.yml | 3 ++- .github/workflows/prepare-release.yml | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 9a724647..a8d93226 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -11,13 +11,15 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - name: Setup PNPM + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: run_install: | - args: [--frozen-lockfile] - - run: pnpm build - name: Check for changeset run: pnpm exec changeset status --since origin/main + - name: Build package + run: pnpm build - name: Create .npmrc run: | cat << EOF > "$HOME/.npmrc" @@ -27,10 +29,12 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Release on @dev tag in npm run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks - - run: | + - name: Get new package version + run: | VERSION=$(cat package.json | jq -r '.version') echo "VERSION=$VERSION" >> "$GITHUB_ENV" - - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + - name: Add installation instructions PR comment + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 env: VERSION: ${{ env.VERSION }} with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 941a21c8..cebe1574 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - name: Setup PNPM + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: run_install: | - args: [--frozen-lockfile] diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index b45f12c5..bcc4b426 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -12,11 +12,11 @@ jobs: name: Prepare release with Changesets runs-on: ubuntu-22.04 steps: - - name: Checkout Repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: token: ${{ secrets.PAT }} - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + - name: Setup PNPM + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: run_install: | - args: [--frozen-lockfile] From 882ea12730351b48f7ccf8d63278aa490e477be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:24:04 +0100 Subject: [PATCH 26/30] remove changeset --- .changeset/eight-spoons-lie.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/eight-spoons-lie.md diff --git a/.changeset/eight-spoons-lie.md b/.changeset/eight-spoons-lie.md deleted file mode 100644 index 067663d9..00000000 --- a/.changeset/eight-spoons-lie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@saleor/app-sdk": patch ---- - -Test workflow From 2ca385f55ce7617ac57b46ec1def16a19bac23e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:24:50 +0100 Subject: [PATCH 27/30] remove leftover --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2bdf5f1b..9dfb9565 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,3 @@ dist .idea/ .vscode/ - -# changeset status -changeset-status.json From 44369a8f1bc2cbd4ccd6bebdc8ffe55e6dd51893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 10:52:04 +0100 Subject: [PATCH 28/30] update check && dry run --- .github/workflows/dev-release.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index a8d93226..0ad4d233 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -5,7 +5,7 @@ on: jobs: release: - if: ${{ contains(github.event.pull_request.labels.*.name, 'release dev tag') }} + if: ${{ github.event.label.name == 'release dev tag' }} runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 diff --git a/package.json b/package.json index 0ea0721b..166a64a0 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepare": "husky install", "lint": "tsc --noEmit && prettier --loglevel warn --write . && eslint --fix .", "copy-readme": "cp README.md dist/README.md", - "publish:ci": "pnpm publish && npx changeset tag && git push --follow-tags", + "publish:ci": "pnpm publish --dry-run && pnpm exec changeset tag && git push --follow-tags", "lint-staged": "lint-staged" }, "keywords": [], From e7c359ebfdfbad4fe909ab948dca23336c002273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:45:37 +0100 Subject: [PATCH 29/30] changes after CR --- .github/workflows/dev-release.yml | 2 +- .github/workflows/main.yml | 28 +++++++++++++++++++++++++-- .github/workflows/prepare-release.yml | 5 +---- .husky/pre-push | 2 +- package.json | 6 ++++-- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 0ad4d233..3beb648d 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -28,7 +28,7 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Release on @dev tag in npm - run: pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks + run: pnpm publish:ci-dev - name: Get new package version run: | VERSION=$(cat package.json | jq -r '.version') diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cebe1574..5ed39ce3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ name: QA on: [pull_request] jobs: - lint-test: + lint: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -12,7 +12,19 @@ jobs: - args: [--frozen-lockfile] - name: Check linters run: pnpm lint - - name: Test + - name: Check types + run: pnpm check-types + + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Setup PNPM + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + with: + run_install: | + - args: [--frozen-lockfile] + - name: Run tests run: pnpm test:ci - name: Generate coverage report uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 @@ -27,3 +39,15 @@ jobs: with: recreate: true path: code-coverage-results.md + + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Setup PNPM + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 + with: + run_install: | + - args: [--frozen-lockfile] + - name: Build package + run: pnpm build diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index bcc4b426..c90c831e 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -13,8 +13,6 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT }} - name: Setup PNPM uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: @@ -27,6 +25,5 @@ jobs: commit: Release to npm publish: "pnpm publish:ci" env: - # Use private access token so Github can trigger another workflow from this one - GITHUB_TOKEN: ${{ secrets.PAT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.husky/pre-push b/.husky/pre-push index 45ac5307..31fc1f98 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -pnpm run test:ci +pnpm check-types && pnpm test:ci diff --git a/package.json b/package.json index 166a64a0..9b49670f 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,11 @@ "test": "vitest", "test:ci": "CI=true vitest --coverage --silent", "prepare": "husky install", - "lint": "tsc --noEmit && prettier --loglevel warn --write . && eslint --fix .", + "check-types": "tsc --noEmit", + "lint": "prettier --loglevel warn --write . && eslint --fix .", "copy-readme": "cp README.md dist/README.md", - "publish:ci": "pnpm publish --dry-run && pnpm exec changeset tag && git push --follow-tags", + "publish:ci-prod": "pnpm publish --dry-run", + "publish:ci-dev": "pnpm publish --dry-run --tag dev", "lint-staged": "lint-staged" }, "keywords": [], From c1b66b7a3a4d97847b457a8a2384f9e7e1ab87ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=BBuraw?= <9116238+krzysztofzuraw@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:56:00 +0100 Subject: [PATCH 30/30] lint tsc error --- .github/dependabot.yml | 1 - .github/workflows/main.yml | 2 +- src/APL/upstash-apl.test.ts | 8 ++++---- src/util/extract-app-permissions-from-jwt.test.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3f8445ae..d1f0d085 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,4 +1,3 @@ - version: 2 updates: - package-ecosystem: "npm" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ed39ce3..a48456d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: with: run_install: | - args: [--frozen-lockfile] - - name: Check linters + - name: Check linter run: pnpm lint - name: Check types run: pnpm check-types diff --git a/src/APL/upstash-apl.test.ts b/src/APL/upstash-apl.test.ts index 03268a41..0c475b69 100644 --- a/src/APL/upstash-apl.test.ts +++ b/src/APL/upstash-apl.test.ts @@ -34,10 +34,10 @@ describe("APL", () => { process.env[UpstashAPLVariables.UPSTASH_URL] = "environment"; const apl = await new UpstashAPL({ restToken: "option", restURL: "option" }); - // eslint-disable-next-line dot-notation - expect(apl["restToken"]).toBe("option"); - // eslint-disable-next-line dot-notation - expect(apl["restURL"]).toBe("option"); + // @ts-expect-error - testing private properties + expect(apl.restToken).toBe("option"); + // @ts-expect-error - testing private properties + expect(apl.restURL).toBe("option"); }); describe("set", () => { diff --git a/src/util/extract-app-permissions-from-jwt.test.ts b/src/util/extract-app-permissions-from-jwt.test.ts index e2567446..a88e9639 100644 --- a/src/util/extract-app-permissions-from-jwt.test.ts +++ b/src/util/extract-app-permissions-from-jwt.test.ts @@ -1,4 +1,4 @@ -import { describe, expect,it } from "vitest"; +import { describe, expect, it } from "vitest"; import { extractAppPermissionsFromJwt } from "./extract-app-permissions-from-jwt";