|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | build: |
10 | | - runs-on: windows-latest |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [windows-latest, ubuntu-latest] # if I add MacOS builds even though I can't test them :skull: -> macos-latest |
11 | 15 |
|
12 | 16 | steps: |
| 17 | + # Step 1 |
13 | 18 | - name: Checkout repository |
14 | 19 | uses: actions/checkout@v2 |
15 | 20 |
|
| 21 | + # Step 2 |
16 | 22 | - name: Setup .NET |
17 | 23 | uses: actions/setup-dotnet@v2 |
18 | 24 | with: |
19 | 25 | dotnet-version: '8.0' |
20 | 26 |
|
| 27 | + # Step 3 |
21 | 28 | - name: Restore dependencies |
22 | 29 | run: dotnet restore |
23 | 30 |
|
| 31 | + # Step 4 |
24 | 32 | - name: Build the project |
25 | | - run: dotnet build --configuration Release |
| 33 | + run: dotnet build --configuration Release --runtime win-x64 --framework net8.0 -p:Optimize=true |
26 | 34 |
|
| 35 | + # Step 5 |
27 | 36 | - name: Run tests |
28 | 37 | run: dotnet test |
29 | 38 |
|
| 39 | + # Step 6 |
30 | 40 | - name: Publish the project |
31 | 41 | run: dotnet publish --configuration Release --runtime win-x64 --framework net8.0 -p:Optimize=true --output ./publish |
| 42 | + |
| 43 | + # Step 7 |
| 44 | + - name: Get version from tag |
| 45 | + id: get_version |
| 46 | + run: echo "VERSION=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///')" >> $GITHUB_ENV |
| 47 | + |
| 48 | + # Step 8 |
| 49 | + - name: Create ZIP archives |
| 50 | + run: | |
| 51 | + if [ $RUNNER_OS == 'Windows' ]; then |
| 52 | + cd ./publish |
| 53 | + powershell Compress-Archive -Path * -DestinationPath "../WriterSharp_${{ env.VERSION }}.zip" |
| 54 | + elif [ $RUNNER_OS == 'Linux' ]; then |
| 55 | + cd ./publish |
| 56 | + zip -r "../WriterSharp_${{ env.VERSION }}.zip" * |
| 57 | + # MacOS down here |
| 58 | + #elif [ $RUNNER_OS == 'macOS' ]; then |
| 59 | + #cd ./publish |
| 60 | + #zip -r "../WriterSharp_${{ env.VERSION }}.zip" * |
| 61 | + fi |
| 62 | +
|
| 63 | + # Step 9 |
| 64 | + - name: Create TAR.GZ archives |
| 65 | + run: | |
| 66 | + if [ $RUNNER_OS == 'Windows' ]; then |
| 67 | + cd ./publish |
| 68 | + tar -czvf "../WriterSharp_${{ env.VERSION }}.tar.gz" * |
| 69 | + elif [ $RUNNER_OS == 'Linux' ]; then |
| 70 | + cd ./publish |
| 71 | + tar -czvf "../WriterSharp_${{ env.VERSION }}.tar.gz" * |
| 72 | + # MacOS down here |
| 73 | + #elif [ $RUNNER_OS == 'macOS' ]; then |
| 74 | + #cd ./publish |
| 75 | + #tar -czvf "../WriterSharp_${{ env.VERSION }}.tar.gz" * |
| 76 | + fi # can we talk about how YAML thinks reversing if sounds like ending an if :skull: |
32 | 77 |
|
| 78 | + # Step 10 |
33 | 79 | - name: Create Release |
34 | 80 | uses: softprops/action-gh-release@v1 |
35 | 81 |
|
|
0 commit comments