Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat: add signing and github release workflow (#2)
Browse files Browse the repository at this point in the history
* Added signing.

* ci: add github actions

* ci: fix workflow

* ci: update workflow

* chore: add renovate

* ci: only test net461

* ci: fix typo

* build: fixes

* ci: optimize
  • Loading branch information
viceice authored Jul 11, 2022
1 parent 6e56a5f commit 1a019be
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 1 deletion.
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: build

on:
push:

env:
DOTNET_NOLOGO: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: windows-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3.0.4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
# restore-keys: |
# ${{ runner.os }}-nuget

- name: restore
run: dotnet restore

- name: build
run: dotnet build --no-restore

- name: test
run: dotnet test --no-build -f net461 .\OpenXmlPowerTools.Tests

build:
needs: [test]
runs-on: windows-latest
timeout-minutes: 15
permissions:
packages: write

env:
VO: true

steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # tag=v3.0.4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
# restore-keys: |
# ${{ runner.os }}-nuget

- name: restore
run: dotnet restore .\OpenXmlPowerTools\

- name: build
run: dotnet build --no-restore .\OpenXmlPowerTools\

- name: pack
run: dotnet pack --no-build -o bin .\OpenXmlPowerTools\

- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: packages
path: bin/*.nupkg

- name: deploy github.com
if: ${{ github.ref_type == 'tag' }}
run: find bin -name '*.nupkg' -exec dotnet nuget push {} -s $NUGET_SOURCE -k $NUGET_KEY --skip-duplicate --force-english-output \;
shell: bash
env:
NUGET_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
NUGET_KEY: ${{ secrets.GITHUB_TOKEN }}

- name: deploy nuget.org
if: ${{ github.ref_type == 'tag' }}
run: find bin -name '*.nupkg' -exec dotnet nuget push {} -s $NUGET_SOURCE -k $NUGET_KEY --skip-duplicate --force-english-output \;
shell: bash
env:
NUGET_SOURCE: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
Binary file added DocumentFormat.OpenXml.snk
Binary file not shown.
25 changes: 25 additions & 0 deletions OpenXmlPowerTools/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<Import Project="../Directory.Build.targets" />

<PropertyGroup>
<MinVerMinimumMajorMinor>5.0</MinVerMinimumMajorMinor>
<MinVerTagPrefix>v</MinVerTagPrefix>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<Product>VisualOn OpenXmlPowerTools</Product>
<Description>Signed version of original OpenXmlPowerTools</Description>
<Company>VisualOn GmbH</Company>
<PackageId>VisualOn.OpenXmlPowerTools</PackageId>
<SignAssembly Condition="'$(VO)' != ''">true</SignAssembly>
<AssemblyOriginatorKeyFile>..\DocumentFormat.OpenXml.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="4.1.0" PrivateAssets="All" />
<PackageReference Condition="'$(VO)' != ''" Update="DocumentFormat.OpenXml" Version="2.17.1" />
<Compile Condition="'$(VO)' != ''" Remove="Properties/AssemblyInfo.cs" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion OpenXmlPowerTools/OpenXmlPowerTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Drawing.Common" Version="4.5.0" />
</ItemGroup>
</Project>
</Project>
35 changes: 35 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>visualon/renovate-config"],
"packageRules": [
{
"description": "Don't automerge until we've good tests",
"matchPackagePatterns": ["*"],
"automerge": false
},
{
"description": "Automerge test deps",
"matchSourceUrls": [
"https://github.com/adamralph/minver",
"https://github.com/dotnet/sourcelink",
"https://github.com/dotnet/roslyn-analyzers",
"https://github.com/DotNetAnalyzers/StyleCopAnalyzers",
"https://github.com/fluffynuts/NExpect",
"https://github.com/microsoft/vstest",
"https://github.com/Microsoft/MSBuildSdks",
"https://github.com/theramis/Snapper",
"https://nsubstitute.github.io/",
"https://togithub.com/fluffynuts/NExpect"
],
"automerge": "true"
},
{
"description": "Automerge test deps",
"matchSourceUrlPrefixes": [
"https://github.com/nsubstitute/",
"https://github.com/nunit/"
],
"automerge": "true"
}
]
}

0 comments on commit 1a019be

Please sign in to comment.