GitHub Actions
GitHub Actions provides a convenient way to automate the obfuscation process for your code by allowing you to specify obfuscation tasks as part of your build and deployment pipeline
This example features a basic WebApi application that showcases how to integrate Babel Obfuscator with GitHub Actions seamlessly. The purpose of this integration is to demonstrate how easily Babel Obfuscator can be added to your project using the NuGet package and how to access the license file through GitHub secrets securely.
In addition, this example provides valuable insights on how to configure NuGet to directly access the GitHub package store and install the Babel Obfuscator NuGet package dependency in your project. By following the step-by-step instructions, you can easily implement Babel Obfuscator in your project and benefit from its powerful obfuscation capabilities.
To help you get started, the sample source code is readily available on our GitHub repository, allowing you to explore the integration process in greater detail.
Integrating Babel Obfuscator with GitHub Actions requires adding a reference to the Babel Obfuscator NuGet package in your project. This package enables Babel Obfuscator to become part of your build process and obfuscate the target assembly. The package can be downloaded and installed directly from the private GitHub NuGet feed.
To set up the Babel Obfuscator NuGet package in the GitHub package store, you'll need to create an access token with enough privileges to publish, install, and delete NuGet packages from the GitHub package store (see GitHub documentation). You can then use the dotnet CLI tool to push the Babel Obfuscator NuGet package.
In the above command:
TOKEN
is your personal access token with enough privileges to publish packages.USERNAME
with the name of your personal account on GitHub.
To install the Babel Obfuscator NuGet package from the GitHub package store, add the following XML configuration file to your project:
In the XML configuration file above:
PACKAGES_TOKEN
is the environment variable containing your personal access token with privileges to read from the storeUSERNAME
with the name of your personal account on GitHub.
Once you've installed the Babel Obfuscator NuGet package, you can configure GitHub Actions to use it in your continuous integration (CI) workflow. This can be achieved by creating a YAML file in your repository that defines your workflow. The YAML file specifies the steps that will be executed during the CI process, including the build step.
Here's an example YAML file:
In addition to the package reference, you will also need to set the BABEL_LICENSE
environment variable to the path of your license file in your CI workflow. You can do this by adding the following line to your workflow file under the env
section:
Where the secret BABEL_LICENSE_SECRET
contains the license key, which is passed to Babel Obfuscator during the build process by setting the following property in the project file.
You can create the BABEL_LICENSE_SECRET
in GitHub repository Settings, under the Security section.
Update the BABEL_LICENSE_SECRET
variable to store the received license type.
Floating License
Set the BABEL_LICENSE_SECRET to the floating license key as follow:
File License
Set the BABEL_LICENSE_SECRET to the path of the license file, for example:
Overall, this example demonstrates how to integrate Babel Obfuscator with GitHub Actions and highlights the importance of securing access to sensitive information such as license keys.
Last updated