From 5460e17bf777ea3b0c0562551f995df155c5de47 Mon Sep 17 00:00:00 2001
From: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
Date: Sat, 30 Oct 2021 05:22:38 -0500
Subject: [PATCH] Add example for C++ vcpkg

---
 README.md   |  1 +
 examples.md | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/README.md b/README.md
index 07f12e8..db21699 100644
--- a/README.md
+++ b/README.md
@@ -86,6 +86,7 @@ Every programming language and framework has its own way of caching.
 
 See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
 
+- [C++ - vcpkg](./examples.md#c++---vcpkg)
 - [C# - Nuget](./examples.md#c---nuget)
 - [D - DUB](./examples.md#d---dub)
 - [Elixir - Mix](./examples.md#elixir---mix)
diff --git a/examples.md b/examples.md
index 7db0ff8..7b31e9f 100644
--- a/examples.md
+++ b/examples.md
@@ -1,5 +1,6 @@
 # Examples
 
+- [C++ - vcpkg](#c++---vcpkg)
 - [C# - NuGet](#c---nuget)
 - [D - DUB](#d---dub)
   - [POSIX](#posix)
@@ -37,6 +38,33 @@
 - [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
 - [Swift - Swift Package Manager](#swift---swift-package-manager)
 
+### C++ - vcpkg
+
+Using [vcpkg](https://vcpkg.io/en/getting-started.html):
+
+```yaml
+# Set the build type environment variable
+env:
+  BUILD_TYPE: Debug
+```
+
+```yaml
+    - name: Cache
+      uses: actions/cache@v2
+      with:
+        # Assuming that vcpkg is installed in `~/vcpkg`
+        # Assuming that the build directory is `./build`
+        path: |
+          ~/vcpkg 
+          ./build/vcpkg_installed
+          ${{ env.HOME }}/.cache/vcpkg/archives
+          ${{ env.XDG_CACHE_HOME }}/vcpkg/archives
+          ${{ env.LOCALAPPDATA }}\vcpkg\archives
+          ${{ env.APPDATA }}\vcpkg\archives
+        key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
+        restore-keys: |
+          ${{ runner.os }}-${{ env.BUILD_TYPE }}
+```
 ## C# - NuGet
 
 Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):