|
1 | | -name: "Tag Release" |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
6 | | - - 'v*' # Push events to every tag not containing / |
| 6 | + - '*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
7 | 11 | jobs: |
8 | 12 | build: |
| 13 | + name: Build assets (${{ matrix.rid }}) |
9 | 14 | runs-on: windows-latest |
10 | | - permissions: |
11 | | - contents: write |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + rid: [win-x64, win-x86] |
| 19 | + |
12 | 20 | steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - - name: Setup .NET SDK |
15 | | - uses: actions/setup-dotnet@v4 |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v6 |
| 23 | + |
| 24 | + - name: Setup .NET |
| 25 | + uses: actions/setup-dotnet@v5 |
16 | 26 | with: |
17 | | - dotnet-version: '8.0.x' |
18 | | - - name: Setup MSBuild |
19 | | - uses: microsoft/setup-msbuild@v2 |
20 | | - - name: Restore NuGet packages |
21 | | - run: dotnet restore |
22 | | - - name: Clean build directories |
23 | | - run: dotnet clean --configuration Release |
24 | | - - name: Run tests |
25 | | - run: dotnet test --configuration Release --no-restore --verbosity normal # Run tests |
26 | | - - name: Build project |
27 | | - run: dotnet publish ${{ github.event.repository.name }} --configuration Release --no-restore --framework net8.0-windows --maxcpucount:1 # Build the app in Release mode |
28 | | - - name: Create artifacts directory |
| 27 | + global-json-file: global.json |
| 28 | + cache: true |
| 29 | + cache-dependency-path: | |
| 30 | + **/*.csproj |
| 31 | +
|
| 32 | + - name: Restore |
| 33 | + run: dotnet restore SOTFEdit.sln |
| 34 | + |
| 35 | + - name: Test (Windows) |
| 36 | + run: dotnet test SOTFEdit.sln -c Release --no-restore --verbosity normal |
| 37 | + |
| 38 | + - name: Publish (Windows) |
29 | 39 | shell: pwsh |
30 | | - run: New-Item -ItemType Directory -Force -Path artifacts | Out-Null |
31 | | - - name: Zip artifacts with PowerShell script |
32 | | - shell: pwsh # Use PowerShell as the shell |
| 40 | + env: |
| 41 | + RID: ${{ matrix.rid }} |
33 | 42 | run: | |
34 | | - # Zip the output files with the assembly name and version |
35 | | - Compress-Archive -Path ${{ github.workspace }}\${{ github.event.repository.name }}\bin\Release\net8.0-windows\publish\* -DestinationPath ${{ github.workspace }}\artifacts\${{ github.event.repository.name }}-${{ github.ref_name }}.zip |
36 | | - - name: Create Release |
37 | | - id: create_release |
38 | | - uses: ncipollo/release-action@v1 |
| 43 | + Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue |
| 44 | + dotnet publish SOTFEdit/SOTFEdit.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/SOTFEdit |
| 45 | +
|
| 46 | + - name: Package (Windows) |
| 47 | + shell: pwsh |
| 48 | + env: |
| 49 | + RID: ${{ matrix.rid }} |
| 50 | + run: | |
| 51 | + Compress-Archive -Path dist/$env:RID/* -DestinationPath SOTFEdit-$env:RID.zip -Force |
| 52 | +
|
| 53 | + - name: Upload asset artifact |
| 54 | + uses: actions/upload-artifact@v6 |
| 55 | + with: |
| 56 | + name: release-asset-${{ matrix.rid }} |
| 57 | + path: SOTFEdit-${{ matrix.rid }}.zip |
| 58 | + |
| 59 | + release: |
| 60 | + name: Create GitHub Release |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: build |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Download assets |
| 66 | + uses: actions/download-artifact@v7 |
| 67 | + with: |
| 68 | + path: release-assets |
| 69 | + merge-multiple: true |
| 70 | + |
| 71 | + - name: Publish GitHub release |
| 72 | + uses: softprops/action-gh-release@v2 |
39 | 73 | with: |
40 | | - artifacts: "artifacts/*" |
41 | | - omitBody: true |
42 | | - makeLatest: true |
43 | | - generateReleaseNotes: true |
| 74 | + files: release-assets/*.zip |
| 75 | + fail_on_unmatched_files: true |
| 76 | + generate_release_notes: true |
0 commit comments