|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build assets (${{ matrix.rid }}) |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: ubuntu-latest |
| 20 | + rid: linux-x64 |
| 21 | + - os: windows-latest |
| 22 | + rid: win-x64 |
| 23 | + - os: windows-latest |
| 24 | + rid: win-x86 |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Setup .NET |
| 31 | + uses: actions/setup-dotnet@v4 |
| 32 | + with: |
| 33 | + global-json-file: global.json |
| 34 | + cache: true |
| 35 | + cache-dependency-path: | |
| 36 | + **/*.csproj |
| 37 | +
|
| 38 | + - name: Restore |
| 39 | + run: dotnet restore cge-tools.sln |
| 40 | + |
| 41 | + - name: Publish (Linux) |
| 42 | + if: runner.os == 'Linux' |
| 43 | + env: |
| 44 | + RID: ${{ matrix.rid }} |
| 45 | + run: | |
| 46 | + set -euo pipefail |
| 47 | + rm -rf dist |
| 48 | + dotnet publish CftConverter/CftConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/cft-converter" |
| 49 | + dotnet publish VbmConverter/VbmConverter.csproj -c Release -r "$RID" --self-contained false -o "dist/$RID/vbm-converter" |
| 50 | +
|
| 51 | + - name: Package (Linux) |
| 52 | + if: runner.os == 'Linux' |
| 53 | + env: |
| 54 | + RID: ${{ matrix.rid }} |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + cd "dist/$RID" |
| 58 | + zip -r "../../cge-tools-$RID.zip" . |
| 59 | +
|
| 60 | + - name: Publish (Windows) |
| 61 | + if: runner.os == 'Windows' |
| 62 | + shell: pwsh |
| 63 | + env: |
| 64 | + RID: ${{ matrix.rid }} |
| 65 | + run: | |
| 66 | + Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue |
| 67 | + dotnet publish CftConverter/CftConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/cft-converter |
| 68 | + dotnet publish VbmConverter/VbmConverter.csproj -c Release -r $env:RID --self-contained false -o dist/$env:RID/vbm-converter |
| 69 | +
|
| 70 | + - name: Package (Windows) |
| 71 | + if: runner.os == 'Windows' |
| 72 | + shell: pwsh |
| 73 | + env: |
| 74 | + RID: ${{ matrix.rid }} |
| 75 | + run: | |
| 76 | + Compress-Archive -Path dist/$env:RID/* -DestinationPath cge-tools-$env:RID.zip -Force |
| 77 | +
|
| 78 | + - name: Upload asset artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: release-asset-${{ matrix.rid }} |
| 82 | + path: cge-tools-${{ matrix.rid }}.zip |
| 83 | + |
| 84 | + release: |
| 85 | + name: Create GitHub Release |
| 86 | + runs-on: ubuntu-latest |
| 87 | + needs: build |
| 88 | + |
| 89 | + steps: |
| 90 | + - name: Download assets |
| 91 | + uses: actions/download-artifact@v4 |
| 92 | + with: |
| 93 | + path: release-assets |
| 94 | + merge-multiple: true |
| 95 | + |
| 96 | + - name: Publish GitHub release |
| 97 | + uses: softprops/action-gh-release@v2 |
| 98 | + with: |
| 99 | + files: release-assets/*.zip |
| 100 | + fail_on_unmatched_files: true |
| 101 | + generate_release_notes: true |
0 commit comments