Skip to content

Commit 6dcad05

Browse files
authored
Build and release workflows (#11)
2 parents 7e63464 + 0fd9359 commit 6dcad05

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: build
22

33
on:
44
push:
5-
branches: [ "main", "build" ]
65
pull_request:
7-
branches: [ "main" ]
6+
branches:
7+
- main
88

99
permissions:
1010
contents: read
@@ -15,17 +15,25 @@ env:
1515
DOTNET_GENERATE_ASPNET_CERTIFICATE: 0
1616
ContinuousIntegrationBuild: true
1717
RestoreLockedMode: true
18-
Configuration: Release
19-
VersionSuffix: preview${{ github.run_id }}
2018

2119
jobs:
2220
build:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ ubuntu-24.04, windows-2022 ]
25+
configuration: [ 'Debug', 'Release' ]
2326

24-
runs-on: ubuntu-22.04
27+
runs-on: ${{ matrix.os }}
28+
29+
env:
30+
Configuration: ${{ matrix.configuration }}
31+
VersionSuffix: preview${{ github.run_id }}
2532

2633
steps:
2734
- name: checkout
2835
uses: actions/checkout@v4
36+
2937
- name: setup dotnet
3038
uses: actions/setup-dotnet@v4
3139
with:
@@ -39,12 +47,14 @@ jobs:
3947

4048
- name: test
4149
run: dotnet test --no-build --no-restore
50+
env:
51+
TestNetCoreOnly: ${{ contains(matrix.os, 'ubuntu') }}
4252

4353
- name: pack
44-
run: dotnet pack --no-build --no-restore -o dist
54+
run: dotnet pack --no-build --no-restore -c ${{ matrix.configuration }} -o dist
4555

4656
- name: publish artifact
4757
uses: actions/upload-artifact@v4
4858
with:
49-
name: VbaCompression_${{ env.VersionSuffix }}
59+
name: VbaCompression_${{ env.VersionSuffix }}_${{ matrix.configuration }}_${{ matrix.os }}
5060
path: '${{ github.workspace }}/dist'

.github/workflows/release.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
tags: [ 'v*.*.*' ]
66

77
permissions:
8+
id-token: write
89
contents: write
910

1011
env:
@@ -21,6 +22,10 @@ jobs:
2122
release:
2223
runs-on: ubuntu-22.04
2324

25+
environment:
26+
name: production
27+
url: https://www.nuget.org/packages/NetOfficeFw.VbaCompression
28+
2429
steps:
2530
- name: checkout
2631
uses: actions/checkout@v4
@@ -50,12 +55,18 @@ jobs:
5055
${{ github.workspace }}/dist
5156
${{ github.workspace }}/src/Kavod.Vba.Compression/README.md
5257
58+
- name: authenticate nuget.org
59+
uses: NuGet/login@v1
60+
id: nuget
61+
with:
62+
user: ${{ secrets.NUGET_PUSH_USER }}
63+
5364
- name: publish
5465
working-directory: '${{ github.workspace}}/dist'
5566
run: |
56-
dotnet nuget push "*.nupkg" --api-key "$NUGET_PUSH_KEY" --source https://api.nuget.org/v3/index.json
67+
dotnet nuget push "*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
5768
env:
58-
NUGET_PUSH_KEY: ${{ secrets.NUGET_PUSH_KEY }}
69+
NUGET_API_KEY: ${{ steps.nuget.outputs.NUGET_API_KEY }}
5970

6071
- name: release
6172
uses: softprops/action-gh-release@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

4+
dist/
5+
46
# User-specific files
57
*.suo
68
*.user

src/Kavod.Vba.Compression.Tests/Kavod.Vba.Compression.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net48;net8.0</TargetFrameworks>
5+
<TargetFrameworks Condition=" '$(TestNetCoreOnly)' == 'true' ">net8.0</TargetFrameworks>
56
<IsPackable>false</IsPackable>
67
</PropertyGroup>
78

0 commit comments

Comments
 (0)