File tree Expand file tree Collapse file tree 2 files changed +80
-28
lines changed
Expand file tree Collapse file tree 2 files changed +80
-28
lines changed Original file line number Diff line number Diff line change 1- name : .NET Release Workflow
1+ name : .NET Release Workflow for Linux (x64)
22
33on :
44 push :
77
88jobs :
99 build :
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
10+ runs-on : ubuntu-latest
1511
1612 steps :
1713 # Step 1
@@ -48,33 +44,15 @@ jobs:
4844 # Step 8
4945 - name : Create ZIP archives
5046 run : |
51- if [[ $RUNNER_OS == 'Windows' ]]; then
52- cd ./publish
53- powershell Compress-Archive -Path (Get-ChildItem -Path . -Recurse | Select-Object -ExpandProperty FullName) -DestinationPath "../WriterSharp_${{ env.VERSION }}_win64.zip"
54- elif [[ $RUNNER_OS == 'Linux' ]]; then
55- cd ./publish
56- zip -r "../WriterSharp_${{ env.VERSION }}_linux64.zip" *
57- # MacOS down here
58- #elif [ $RUNNER_OS == 'macOS' ]; then
59- #cd ./publish
60- #zip -r "../WriterSharp_${{ env.VERSION }}.zip" *
61- fi
47+ cd ./publish
48+ zip -r "../WriterSharp_${{ env.VERSION }}_linux64.zip" *
6249 shell : bash
6350
6451 # Step 9
6552 - name : Create TAR.GZ archives
6653 run : |
67- if [[ $RUNNER_OS == 'Windows' ]]; then
68- cd ./publish
69- tar -czvf "../WriterSharp_${{ env.VERSION }}_win64.tar.gz" *
70- elif [[ $RUNNER_OS == 'Linux' ]]; then
71- cd ./publish
72- tar -czvf "../WriterSharp_${{ env.VERSION }}_linux64.tar.gz" *
73- # MacOS down here
74- #elif [ $RUNNER_OS == 'macOS' ]; then
75- #cd ./publish
76- #tar -czvf "../WriterSharp_${{ env.VERSION }}.tar.gz" *
77- fi # can we talk about how YAML thinks reversing if sounds like ending an if :skull:
54+ cd ./publish
55+ tar -czvf "../WriterSharp_${{ env.VERSION }}_linux64.tar.gz" *
7856 shell : bash
7957
8058 - name : Append Release Warning
Original file line number Diff line number Diff line change 1+ name : .NET Release Workflow for Windows (x64)
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ jobs :
9+ build :
10+ runs-on : windows-latest
11+
12+ steps :
13+ # Step 1
14+ - name : Checkout repository
15+ uses : actions/checkout@v2
16+
17+ # Step 2
18+ - name : Setup .NET
19+ uses : actions/setup-dotnet@v2
20+ with :
21+ dotnet-version : ' 8.0'
22+
23+ # Step 3
24+ - name : Restore dependencies
25+ run : dotnet restore
26+
27+ # Step 4
28+ - name : Build the project
29+ run : dotnet build --configuration Release --runtime win-x64 --framework net8.0 -p:Optimize=true
30+
31+ # Step 5
32+ - name : Run tests
33+ run : dotnet test
34+
35+ # Step 6
36+ - name : Publish the project
37+ run : dotnet publish --configuration Release --runtime win-x64 --framework net8.0 -p:Optimize=true --output ./publish
38+
39+ # Step 7
40+ - name : Get version from tag
41+ id : get_version
42+ run : echo "VERSION=$(echo ${GITHUB_REF} | sed 's/refs\/tags\///')" >> $GITHUB_ENV
43+
44+ # Step 8
45+ - name : Create ZIP archives
46+ run : |
47+ cd ./publish
48+ powershell Compress-Archive -Path (Get-ChildItem -Path . -Recurse | Select-Object -ExpandProperty FullName) -DestinationPath "../WriterSharp_${{ env.VERSION }}_win64.zip"
49+ shell : bash
50+
51+ # Step 9
52+ - name : Create TAR.GZ archives
53+ run : |
54+ cd ./publish
55+ tar -czvf "../WriterSharp_${{ env.VERSION }}_win64.tar.gz" *
56+
57+ - name : Append Release Warning
58+ run :
59+ echo "> [!WARNING]" >> LatestReleaseNotes.md
60+ echo "> The following binaries were not compiled manually. Use them at your own risk." >> LatestReleaseNotes.md"
61+
62+ # Step 10
63+ - name : Create Release
64+ uses : softprops/action-gh-release@v1
65+
66+ with :
67+ body_path : LatestReleaseNotes.md
68+ generate_release_notes : true
69+ files : |
70+ ./*.zip
71+ ./*.tar.gz
72+
73+ env :
74+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments