Skip to content

Commit

Permalink
Merge pull request #6 from VAllens/develop
Browse files Browse the repository at this point in the history
Add support for pushing to GitHub packages
  • Loading branch information
VAllens authored Feb 17, 2022
2 parents 3abc5f3 + f98cb43 commit df3a353
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
- name: Build Obfuscation.Fody.NuGet project
run: dotnet build src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-restore --configuration Release
- name: Pack Obfuscation.Fody.NuGet project
run: dotnet pack src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-build --configuration Release
run: dotnet pack src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-build --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg -o .
- name: Test
run: dotnet test --no-build --verbosity normal
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
schedule:
- cron: '40 15 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
13 changes: 5 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ jobs:
- name: Build Obfuscation.Fody.NuGet project
run: dotnet build src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-restore --configuration Release
- name: Pack Obfuscation.Fody.NuGet project
run: dotnet pack src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-build --configuration Release
- name: publish nuget package on version change
uses: rohith/publish-nuget@v2
with:
PROJECT_FILE_PATH: src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj
PACKAGE_NAME: Obfuscation.Fody
VERSION_FILE_PATH: Directory.Build.props
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
run: dotnet pack src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj --no-build --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg -o .
- name: Publish package to NuGet
run: dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source "https://api.nuget.org/v3/index.json" --skip-duplicate
- name: publish package to GitHub
run: dotnet nuget push *.nupkg --api-key ${{secrets.PUBLISH_TO_GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/VAllens/index.json" --skip-duplicate
7 changes: 0 additions & 7 deletions NuGet.Config

This file was deleted.

56 changes: 48 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
# Obfuscation.Fody
# ![Obfuscation.Fody](https://github.com/VAllens/Obfuscation.Fody/raw/main/fody.png) Obfuscation.Fody

[![.NET Build](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/build.yml/badge.svg?branch=develop&event=push)](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/build.yml) [![NuGet Publish](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/publish.yml/badge.svg?branch=main&event=pull_request)](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/publish.yml)
[![.NET Build](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/build.yml/badge.svg?branch=develop&event=push)](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/build.yml)
[![NuGet Publish](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/publish.yml/badge.svg?branch=main&event=pull_request)](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/publish.yml)
[![CodeQL](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/codeql-analysis.yml/badge.svg?branch=develop&event=push)](https://github.com/VAllens/Obfuscation.Fody/actions/workflows/codeql-analysis.yml)

## This is a [Fody](https://github.com/Fody/Fody) extension to modify `ObfuscationAttribute`.
## Summary

This is a **[Fody](https://github.com/Fody/Fody)** extension to modify `ObfuscationAttribute`.

## Usage

.NET CLI:

```cmd
dotnet add package Obfuscation.Fody --version 1.0.0
```

or PowerShell:

```powershell
Install-Package Obfuscation.Fody -Version 1.0.0
```

or Edit project items:

```xml
<ItemGroup>
<PackageReference Include="Obfuscation.Fody" Version="1.0.0" />
</ItemGroup>
```

It will get the attribute target that contains `ObfuscationAttribute`, and filter out the attribute target whose `Exclude` property value is equal to `true`, and modify the eligible `Feature` property value. Other properties remain the same.

Expand All @@ -18,7 +44,9 @@ The `Feature` configuration item is required, otherwise the `Obfuscation.Fody` e
The `Append` configuration item will decide whether to override the original `Feature` property value or append it.
The `Append` default value is `false`, it is optional.

[Attribute targets](https://docs.microsoft.com/en-us/dotnet/api/system.attributetargets) Support:
## Support

[Attribute targets](https://docs.microsoft.com/en-us/dotnet/api/system.attributetargets):

- Assembly
- Class
Expand All @@ -31,7 +59,19 @@ The `Append` default value is `false`, it is optional.
- Interface
- Parameter
- Delegate
- Record (a special class)
- Indexer (a special property)
- Destructor (a special method)
- Constructor parameters (The Constructor is a special method)
- Record (**a special class**)
- Indexer (**a special property**)
- Destructor (**a special method**)
- Constructor parameters (**The Constructor is a special method**)

## Samples

- [ObfuscationFodySamples](https://github.com/VAllens/Obfuscation.Fody/tree/develop/samples)

## Authors

- [Allen Cai](https://github.com/VAllens)

## License

[MIT](LICENSE)
4 changes: 2 additions & 2 deletions src/Obfuscation.Fody.NuGet/Obfuscation.Fody.NuGet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<PackageReference Include="FodyPackaging" Version="6.6.0" PrivateAssets="All" />
</ItemGroup>

<Target Name="CopyPackages" AfterTargets="GenerateNuspec">
<!--<Target Name="CopyPackages" AfterTargets="GenerateNuspec">
<PropertyGroup>
<OutputPackageDir>$(SolutionDir)packages</OutputPackageDir>
<NuPkgFiles>$(ProjectDir)$(OutDir)$(PackageId).$(Version).nupkg</NuPkgFiles>
Expand All @@ -44,6 +44,6 @@
<Message Text="NuPkgFiles: $(NuPkgFiles)" Importance="high" />
<Copy SourceFiles="$(NuPkgFiles)" DestinationFolder="$(OutputPackageDir)" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="true" />
<Message Text="Copy $(NuPkgFiles) to $(OutputPackageDir) successfully" Importance="high" />
</Target>
</Target>-->

</Project>

0 comments on commit df3a353

Please sign in to comment.