diff --git a/.github/workflows/deploy-preview-storefrontcloud.yml b/.github/workflows/deploy-preview-storefrontcloud.yml index 085d79181..3a5d42723 100644 --- a/.github/workflows/deploy-preview-storefrontcloud.yml +++ b/.github/workflows/deploy-preview-storefrontcloud.yml @@ -1,5 +1,9 @@ name: Deploy PR Preview on Storefrontcloud -on: +env: + CANARY_SW6_INSTANCE: https://shopware6-demo.vuestorefront.io + CANARY_SW6_INSTANCE_TOKEN: SWSCVJJET0RQAXFNBMTDZTV1OQ + INSTANCE_CODE: shopware-pwa-canary +on: pull_request: types: [opened, synchronize] @@ -21,7 +25,7 @@ jobs: run: | mkdir test-project cd ./test-project - ../packages/cli/bin/shopware-pwa init --u ${{ secrets.SHOPWARE_ADMIN_USER }} --p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }} --ci --devMode --stage local + ../packages/cli/bin/shopware-pwa init --shopwareEndpoint=${{ env.CANARY_SW6_INSTANCE }} --shopwareAccessToken=${{ env.CANARY_SW6_INSTANCE_TOKEN }} --u ${{ secrets.SHOPWARE_ADMIN_USER }} --p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }} --ci --devMode --stage local yarn build - name: Build and publish docker image uses: elgohr/Publish-Docker-Github-Action@master @@ -48,14 +52,14 @@ jobs: uses: mkucmus/storefrontcloud-preview-deploy@master with: token: "${{ github.token }}" - namespace: "shopware-pwa" + namespace: "${{env.INSTANCE_CODE}}" - name: Comment PR if: success() uses: mkucmus/storefrontcloud-comment-pr-preview-deploy@master with: - preview_url: '${{ steps.deploy.outputs.preview_url }}' + preview_url: "${{ steps.deploy.outputs.preview_url }}" token: "${{ github.token }}" - namespace: 'shopware-pwa' + namespace: "${{env.INSTANCE_CODE}}" - name: Update deployment status (success) if: success() uses: chrnorm/deployment-status@releases/v1 diff --git a/.github/workflows/deploy-storefrontcloud.yml b/.github/workflows/deploy-storefrontcloud.yml index 07d3bb31c..cd7cb964f 100644 --- a/.github/workflows/deploy-storefrontcloud.yml +++ b/.github/workflows/deploy-storefrontcloud.yml @@ -1,27 +1,23 @@ name: Deploy to Storefrontcloud on: - push: - branches: - - master + release: + types: [published] +env: + RELEASE_URL: https://shopware-pwa.storefrontcloud.io + INSTANCE_CODE: shopware-pwa + jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: "12.x" - - name: Build packages + - name: Install shopware-pwa cli run: | - yarn - yarn build --ci - - name: Create theme project + yarn global add @shopware-pwa/cli + - name: Create project (release) run: | mkdir test-project cd ./test-project - ../packages/cli/bin/shopware-pwa init --u ${{ secrets.SHOPWARE_ADMIN_USER }} --p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }} --ci --devMode --stage local + shopware-pwa init --u ${{ secrets.SHOPWARE_ADMIN_USER }} --p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }} --ci --devMode yarn build - name: Build and publish docker image uses: elgohr/Publish-Docker-Github-Action@master @@ -41,15 +37,15 @@ jobs: id: deployment with: token: "${{ github.token }}" - target_url: https://shopware-pwa.storefrontcloud.io + target_url: ${{ env.RELEASE_URL }} environment: production initial_status: in_progress - name: Deploy on Storefrontcloud.io run: | - if curl -s -u ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"shopware-pwa","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then + if curl -s -u ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"${{ env.INSTANCE_CODE }}","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then echo "Instance updated" else - echo "Something went wrong during the update process..." + echo "Deployment failed" exit 1 fi - name: Update deployment status (success) @@ -57,7 +53,7 @@ jobs: uses: chrnorm/deployment-status@releases/v1 with: token: "${{ github.token }}" - target_url: https://shopware-pwa.storefrontcloud.io + target_url: ${{ env.RELEASE_URL }} state: "success" description: Congratulations! The deploy is done. deployment_id: ${{ steps.deployment.outputs.deployment_id }} @@ -66,7 +62,7 @@ jobs: uses: chrnorm/deployment-status@releases/v1 with: token: "${{ github.token }}" - target_url: https://shopware-pwa.storefrontcloud.io + target_url: ${{ env.RELEASE_URL }} description: Unfortunately, the instance hasn't been updated. state: "failure" deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/deploy-zeit.yml b/.github/workflows/deploy-zeit.yml deleted file mode 100644 index eb2aaf4ac..000000000 --- a/.github/workflows/deploy-zeit.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Deploy Zeit -on: - push: - branches: - - zeit - # pull_request: - # types: [opened, synchronize] -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: "10.x" - # - name: Clone SFUI # temp step for development - # run: | - # yarn - # node ./scripts/prepareSFUIRepoClone.js - - name: Build packages - run: | - yarn - yarn build --ci - - name: Create theme project - run: | - mkdir test-project - cd ./test-project - ../packages/cli/bin/shopware-pwa init - cd ../ - - name: Deploy PR to zeit - if: github.event_name == 'pull_request' - uses: patzick/now-deployment@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - zeit-token: ${{ secrets.ZEIT_TOKEN }} - zeit-team-id: team_zpOFzrZjyURkFwGZsKEEHzcv - - name: Deploy Production to zeit - if: github.event_name != 'pull_request' - uses: patzick/now-deployment@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - zeit-token: ${{ secrets.ZEIT_TOKEN }} - zeit-team-id: team_zpOFzrZjyURkFwGZsKEEHzcv - now-args: "--prod" diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index 8478b43b4..02898fbaf 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -1,4 +1,9 @@ -name: Publish canary +name: Publish & deploy canary version +env: + CANARY_SW6_INSTANCE: https://shopware6-demo.vuestorefront.io + CANARY_SW6_INSTANCE_TOKEN: SWSCVJJET0RQAXFNBMTDZTV1OQ + CANARY_URL: https://shopware-pwa-canary.storefrontcloud.io + INSTANCE_CODE: shopware-pwa-canary on: push: branches: @@ -24,3 +29,62 @@ jobs: yarn lerna publish --canary --force-publish --yes --preid prealpha --dist-tag canary env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + build: + runs-on: ubuntu-latest + steps: + - name: Install shopware-pwa cli + run: | + yarn global add @shopware-pwa/cli@canary + - name: Create default-theme project + run: | + mkdir app + cd ./app + shopware-pwa init --shopwareEndpoint=${{ env.CANARY_SW6_INSTANCE }} --shopwareAccessToken=${{ env.CANARY_SW6_INSTANCE_TOKEN }} --u ${{ secrets.SHOPWARE_ADMIN_USER }} --p ${{ secrets.SHOPWARE_ADMIN_PASSWORD }} --ci --devMode --stage canary + yarn build + - name: Build and publish docker image + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: shopware-pwa-storefrontcloud-io/vue-storefront:${{ github.sha }} + registry: registry.storefrontcloud.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./app + buildoptions: "--compress" + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - uses: chrnorm/deployment-action@releases/v1 + name: Create GitHub deployment + id: deployment + with: + token: "${{ github.token }}" + target_url: ${{ env.CANARY_URL }} + environment: canary + initial_status: in_progress + - name: Deploy on StorefrontCloud.io + run: | + if curl -s -u ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"${{ env.INSTANCE_CODE }}","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then + echo "Instance updated" + else + echo "Deployment failed" + exit 1 + fi + - name: Update deployment status (success) + if: success() + uses: chrnorm/deployment-status@releases/v1 + with: + token: "${{ github.token }}" + target_url: ${{ env.CANARY_URL }} + state: "success" + description: Congratulations! The deploy is done. + deployment_id: ${{ steps.deployment.outputs.deployment_id }} + - name: Update deployment status (failure) + if: failure() + uses: chrnorm/deployment-status@releases/v1 + with: + token: "${{ github.token }}" + target_url: ${{ env.CANARY_URL }} + description: Unfortunately, the instance hasn't been updated. + state: "failure" + deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/packages/composables/__tests__/useProductListing.spec.ts b/packages/composables/__tests__/useProductListing.spec.ts index fd9d75269..8306a3fb7 100644 --- a/packages/composables/__tests__/useProductListing.spec.ts +++ b/packages/composables/__tests__/useProductListing.spec.ts @@ -106,7 +106,7 @@ describe("Composables - useProductListing", () => { const { products, selectedFilters } = useProductListing([ { product: "1" } as any, ]); - expect(selectedFilters.value).toStrictEqual({ categoryTree: [] }); + expect(selectedFilters.value).toStrictEqual({}); expect(products.value).toHaveLength(1); }); diff --git a/packages/composables/src/hooks/useProductListing.ts b/packages/composables/src/hooks/useProductListing.ts index 763ba17d2..901957528 100644 --- a/packages/composables/src/hooks/useProductListing.ts +++ b/packages/composables/src/hooks/useProductListing.ts @@ -163,7 +163,7 @@ export const useProductListing = ( if (initialProducts.length) { resetFilters(); resetSorting(); - changePagination(1); + //changePagination(1); } const pagination: any = computed(() => localPagination); diff --git a/packages/default-theme/cms/elements/CmsElementProductListing.vue b/packages/default-theme/cms/elements/CmsElementProductListing.vue index 74b8f1b49..79250794b 100644 --- a/packages/default-theme/cms/elements/CmsElementProductListing.vue +++ b/packages/default-theme/cms/elements/CmsElementProductListing.vue @@ -49,7 +49,7 @@ export default { }, }, setup({ content }) { - const propProducts = content.data.listing || [] + const propProducts = content.data.listing.elements || [] const { products, changePagination, diff --git a/test/test b/test/test new file mode 160000 index 000000000..d1835fec8 --- /dev/null +++ b/test/test @@ -0,0 +1 @@ +Subproject commit d1835fec87adc9550baec15bca812fb8513552cb