|
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
| 8 | + pull_request: |
8 | 9 |
|
9 | 10 | jobs: |
10 | 11 | build: |
| 12 | + if: | |
| 13 | + github.event_name == 'push' || |
| 14 | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) |
11 | 15 | runs-on: ${{ matrix.os }} |
12 | 16 | strategy: |
13 | 17 | matrix: |
14 | 18 | os: [ubuntu-latest, macos-latest, windows-latest] |
15 | 19 | steps: |
16 | | - - uses: actions/checkout@v5 |
17 | | - - name: Setup .NET |
18 | | - uses: actions/setup-dotnet@v5 |
19 | | - with: |
20 | | - dotnet-version: | |
21 | | - 8.0.x |
22 | | - 10.0.x |
23 | | - - name: Restore dependencies |
24 | | - run: dotnet restore |
25 | | - - name: Build |
26 | | - run: dotnet build --configuration Release --no-restore |
27 | | - - name: Test |
28 | | - run: dotnet test --no-build --verbosity normal --configuration Release --logger "trx;LogFileName=${{ runner.workspace }}/OpenXmlPowerTools/TestResult/test_results.trx" |
29 | | - - name: Publish Unit Test Results |
30 | | - uses: actions/upload-artifact@v5 |
31 | | - if: failure() |
32 | | - with: |
33 | | - name: TestResult |
34 | | - path: "TestResult/**/*" |
| 20 | + - uses: actions/checkout@v6 |
| 21 | + - name: Setup .NET |
| 22 | + uses: actions/setup-dotnet@v5 |
| 23 | + with: |
| 24 | + dotnet-version: | |
| 25 | + 8.0.x |
| 26 | + 10.0.x |
| 27 | + - name: Restore dependencies |
| 28 | + run: dotnet restore |
| 29 | + - name: Build |
| 30 | + run: dotnet build --configuration Release --no-restore |
| 31 | + - name: Test |
| 32 | + run: dotnet test --no-build --verbosity normal --configuration Release --logger "trx;LogFileName=${{ runner.workspace }}/OpenXmlPowerTools/TestResult/test_results.trx" |
| 33 | + - name: Upload build artifacts |
| 34 | + uses: actions/upload-artifact@v6 |
| 35 | + if: matrix.os == 'ubuntu-latest' |
| 36 | + with: |
| 37 | + name: build-artifacts |
| 38 | + path: | |
| 39 | + OpenXmlPowerTools/bin/Release/ |
| 40 | + - name: Publish Unit Test Results |
| 41 | + uses: actions/upload-artifact@v6 |
| 42 | + if: failure() |
| 43 | + with: |
| 44 | + name: TestResult |
| 45 | + path: "TestResult/**/*" |
35 | 46 |
|
36 | 47 | deployRelease: |
37 | | - if: github.ref == 'refs/heads/release' |
| 48 | + if: github.event_name == 'push' && github.ref == 'refs/heads/release' |
38 | 49 | runs-on: ubuntu-latest |
39 | | - needs: build |
| 50 | + needs: build |
40 | 51 | steps: |
41 | | - - uses: actions/checkout@v5 |
42 | | - - name: Setup .NET |
43 | | - uses: actions/setup-dotnet@v5 |
44 | | - with: |
45 | | - dotnet-version: | |
46 | | - 8.0.x |
47 | | - 10.0.x |
48 | | - - name: Restore dependencies |
49 | | - run: dotnet restore |
50 | | - - name: Build |
51 | | - run: dotnet build --configuration Release --no-restore |
52 | | - - name: NugetPush |
53 | | - env: |
| 52 | + - uses: actions/checkout@v6 |
| 53 | + - name: Download build artifacts |
| 54 | + uses: actions/download-artifact@v6 |
| 55 | + with: |
| 56 | + name: build-artifacts |
| 57 | + - name: NugetPush |
| 58 | + env: |
54 | 59 | NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TOKEN }} |
55 | | - if: env.NUGET_TOKEN_EXISTS != '' |
56 | | - run: | |
57 | | - dotnet nuget push ./OpenXmlPowerTools/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json |
58 | | - - name: Github Release |
59 | | - shell: bash |
60 | | - env: |
61 | | - GITHUB_TOKEN: ${{ github.TOKEN }} |
62 | | - if: env.GITHUB_TOKEN != '' |
63 | | - run: | |
64 | | - gh release create ${{env.CURRENT_VERSION}} ./OpenXmlPowerTools/bin/Release/*.*nupkg --generate-notes |
| 60 | + if: env.NUGET_TOKEN_EXISTS != '' |
| 61 | + run: | |
| 62 | + dotnet nuget push *.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json |
| 63 | + - name: Github Release |
| 64 | + shell: bash |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ github.TOKEN }} |
| 67 | + if: env.GITHUB_TOKEN != '' |
| 68 | + run: | |
| 69 | + gh release create ${{env.CURRENT_VERSION}} *.*nupkg --generate-notes |
65 | 70 |
|
66 | 71 | deployTest: |
67 | | - if: github.ref == 'refs/heads/main' |
| 72 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
68 | 73 | runs-on: ubuntu-latest |
69 | | - needs: build |
| 74 | + needs: build |
70 | 75 | steps: |
71 | | - - uses: actions/checkout@v5 |
72 | | - - name: Setup .NET |
73 | | - uses: actions/setup-dotnet@v5 |
74 | | - with: |
75 | | - dotnet-version: | |
76 | | - 8.0.x |
77 | | - 10.0.x |
78 | | - - name: Restore dependencies |
79 | | - run: dotnet restore |
80 | | - - name: Build |
81 | | - run: dotnet build --configuration Release --no-restore |
82 | | - - name: NugetPush |
83 | | - env: |
| 76 | + - uses: actions/checkout@v6 |
| 77 | + - name: Download build artifacts |
| 78 | + uses: actions/download-artifact@v6 |
| 79 | + with: |
| 80 | + name: build-artifacts |
| 81 | + - name: NugetPush |
| 82 | + env: |
84 | 83 | NUGET_TOKEN_EXISTS: ${{ secrets.NUGET_TEST_TOKEN }} |
85 | | - if: env.NUGET_TOKEN_EXISTS != '' |
86 | | - run: | |
87 | | - ls ./OpenXmlPowerTools/bin/Release |
88 | | - dotnet nuget push ./OpenXmlPowerTools/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json |
89 | | -
|
90 | | - - name: Github Prerelease |
91 | | - shell: bash |
92 | | - env: |
93 | | - GITHUB_TOKEN: ${{ github.TOKEN }} |
94 | | - if: env.GITHUB_TOKEN != '' |
95 | | - run: | |
96 | | - gh release create ${{env.CURRENT_VERSION}} ./OpenXmlPowerTools/bin/Release/*.*nupkg --prerelease --generate-notes |
| 84 | + if: env.NUGET_TOKEN_EXISTS != '' |
| 85 | + run: | |
| 86 | + ls |
| 87 | + dotnet nuget push *.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json |
| 88 | + - name: Github Prerelease |
| 89 | + shell: bash |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ github.TOKEN }} |
| 92 | + if: env.GITHUB_TOKEN != '' |
| 93 | + run: | |
| 94 | + gh release create ${{env.CURRENT_VERSION}} *.*nupkg --prerelease --generate-notes |
0 commit comments