Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/1.4.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pushnitsa committed Nov 12, 2020
2 parents ce76133 + 910d2c5 commit 3fada45
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# v1.1.1.vc-demo-storefront
name: Storefront CI

# Controls when the action will run. Triggers the workflow on push or pull request
Expand Down Expand Up @@ -29,8 +30,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
NUGET_KEY: ${{ secrets.NUGET_KEY }}
BLOB_SAS: ${{ secrets.BLOB_TOKEN }}
PUBLISH_TO_DOCKER: "false"
UPDATE_LATEST_TAG: "true"

steps:

- name: Set variables
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "PUBLISH_TO_DOCKER=false" >> $GITHUB_ENV
echo "UPDATE_LATEST_TAG=false" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
Expand All @@ -50,7 +60,10 @@ jobs:
uses: VirtoCommerce/vc-github-actions/changelog-generator@master

- name: Add version suffix
if: ${{ github.ref != 'refs/heads/master' }}
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
with:
versionSuffix: ${{ steps.image.outputs.suffix }}

- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
Expand All @@ -65,52 +78,50 @@ jobs:
uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@master

- name: Quality Gate
uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@VP-5059
uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@master
with:
login: ${{secrets.SONAR_TOKEN}}

- name: Packaging
run: vc-build Compress -skip Clean+Restore+Compile+Test

# Step runs only on commit to master or dev brunch
- name: Build Docker Image
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
id: dockerBuild
uses: VirtoCommerce/vc-github-actions/build-docker-image@master
with:
imageName: "demo-storefront"
tag: ${{ steps.image.outputs.taggedVersion }}
imageName: "demo-storefront"
dockerFiles: "https://raw.githubusercontent.com/VirtoCommerce/vc-docker/master/linux/storefront/Dockerfile"

- name: Publish to Blob
if: ${{ github.ref == 'refs/heads/dev' }}
if: ${{ github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
id: blobRelease
uses: VirtoCommerce/vc-github-actions/publish-blob-release@VP-5059
uses: VirtoCommerce/vc-github-actions/publish-blob-release@master
with:
blobSAS: ${{ secrets.BLOB_TOKEN }}

- name: Publish Github Release
if: ${{ github.ref == 'refs/heads/master' }}
with:
changelog: ${{ steps.changelog.outputs.changelog }}
uses: VirtoCommerce/vc-github-actions/publish-github-release@VP-5059
uses: VirtoCommerce/vc-github-actions/publish-github-release@master

# Step runs only on commit to master or dev brunch
- name: Docker Login
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}

# Step runs only on commit to master or dev brunch
- name: Publish Docker Image
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
uses: VirtoCommerce/vc-github-actions/publish-docker-image@master
with:
image: ${{ steps.dockerBuild.outputs.imageName }}
tag: ${{ steps.image.outputs.taggedVersion }}
docker_user: ${{ secrets.DOCKER_USERNAME }}
docker_token: ${{ secrets.DOCKER_TOKEN }}
docker_hub: 'false'
docker_hub: ${{ env.PUBLISH_TO_DOCKER }}
update_latest: ${{ env.UPDATE_LATEST_TAG }}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Authors>VirtoCommerce</Authors>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>1.3.0</VersionPrefix>
<VersionPrefix>1.4.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
28 changes: 28 additions & 0 deletions VirtoCommerce.Storefront/Domain/Cart/Demo/DemoCartBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using VirtoCommerce.Storefront.Model;
using VirtoCommerce.Storefront.Model.Caching;
using VirtoCommerce.Storefront.Model.Cart;
using VirtoCommerce.Storefront.Model.Cart.Demo;
using VirtoCommerce.Storefront.Model.Cart.Services;
using VirtoCommerce.Storefront.Model.Cart.Validators;
using VirtoCommerce.Storefront.Model.Common;
Expand Down Expand Up @@ -119,6 +120,33 @@ public override async Task ClearAsync()
Cart.ConfiguredGroups.Clear();
}

public override async Task MergeWithCartAsync(ShoppingCart cart)
{
EnsureCartExists();

foreach (var group in cart.ConfiguredGroups)
{
var newGroup = new ConfiguredGroup(group.Quantity, group.Currency, group.ProductId);
Cart.ConfiguredGroups.Add(newGroup);

foreach (var item in group.Items)
{
var newItem = (LineItem) item.Clone();
newItem.ConfiguredGroupId = newGroup.Id;
var existingLineItem = cart.Items.FirstOrDefault(li => li.ProductId.EqualsInvariant(newItem.ProductId));

if (existingLineItem != null)
{
cart.Items.Remove(existingLineItem);
}

await AddLineItemAsync(newItem);
}
}

await base.MergeWithCartAsync(cart);
}

protected override async Task AddLineItemAsync(LineItem lineItem)
{
var existingLineItem = Cart.Items.FirstOrDefault(li => li.ProductId.EqualsInvariant(lineItem.ProductId)
Expand Down
4 changes: 3 additions & 1 deletion VirtoCommerce.Storefront/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddResponseCaching();

services.Configure<StorefrontOptions>(Configuration.GetSection("VirtoCommerce"));

//The IHttpContextAccessor service is not registered by default
//https://github.com/aspnet/Hosting/issues/793
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
Expand Down Expand Up @@ -384,10 +384,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseForwardedHeaders();
}
else
{
app.UseExceptionHandler("/error/500");
app.UseForwardedHeaders();
app.UseHsts();
}
// Do not write telemetry to debug output
Expand Down

0 comments on commit 3fada45

Please sign in to comment.