This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
forked from OpenXmlDev/Open-Xml-PowerTools
-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (107 loc) · 3.99 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: build
on:
push:
env:
DOTNET_NOLOGO: true
ProjectLoadStyle: All
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 2
filter: blob:none
show-progress: false
- uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
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
- name: Codecov
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
with:
files: '**/TestResults/*/*.cobertura.xml'
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
build:
needs: [test]
runs-on: windows-latest
timeout-minutes: 15
permissions:
contents: write
packages: write
env:
VO: true
Configuration: Release
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
show-progress: false
- uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
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: pack
run: dotnet pack -o bin .\OpenXmlPowerTools\
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: packages
path: bin/*.nupkg
- name: deploy github.com
if: ${{ github.ref_type == 'tag' }}
run: find bin -name '*.nupkg' | xargs 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' | xargs 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 }}
gh-release:
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ github.ref_type == 'tag' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0 # Important for changelog
filter: blob:none
show-progress: false
- name: prepare version
run: echo VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_ENV # trim leading 'v' from tag name
- name: Generate changelog with git-cliff
uses: tj-actions/git-cliff@75599f745633e29f99bd9e14a30865b7d2fcbe84 # v1.5.0
with:
args: --latest --strip all
output: "CHANGELOG.md"
- name: Create Release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
bodyFile: "CHANGELOG.md"
name: ${{ env.VERSION }}
prerelease: ${{ contains(github.ref_name, '-') }}