11name : Build
22
3- on : push
3+ on :
4+ push :
5+ pull_request :
46
57permissions :
68 contents : read
@@ -10,16 +12,97 @@ jobs:
1012 runs-on : ubuntu-latest
1113
1214 steps :
13- - name : Checkout repository
14- uses : actions/checkout@v7
15+ - uses : actions/checkout@v7
1516
1617 - name : Setup .NET 10 SDK
1718 uses : actions/setup-dotnet@v5
1819 with :
1920 dotnet-version : 10.0.x
2021
21- - name : Restore solution
22+ - name : Restore
2223 run : dotnet restore src/EtcdTerminal.slnx
2324
24- - name : Build solution
25+ - name : Build
2526 run : dotnet build src/EtcdTerminal.slnx --configuration Release --no-restore
27+
28+ - name : Test
29+ run : dotnet test src/EtcdTerminal.slnx --configuration Release --no-build
30+
31+ - name : Publish linux-x64
32+ run : |
33+ dotnet publish src/EtcdTerminal.App/ \
34+ --configuration Release \
35+ --runtime linux-x64 \
36+ --self-contained \
37+ -p:PublishSingleFile=true \
38+ -o publish/linux-x64
39+
40+ - name : Publish win-x64
41+ run : |
42+ dotnet publish src/EtcdTerminal.App/ \
43+ --configuration Release \
44+ --runtime win-x64 \
45+ --self-contained \
46+ -p:PublishSingleFile=true \
47+ -o publish/win-x64
48+
49+ - name : Package linux-x64
50+ run : tar czf etcd-terminal-linux-x64.tar.gz -C publish/linux-x64 etcd-terminal
51+
52+ - name : Package win-x64
53+ run : zip -j etcd-terminal-win-x64.zip publish/win-x64/etcd-terminal.exe
54+
55+ - name : Upload artifacts
56+ uses : actions/upload-artifact@v7
57+ with :
58+ name : artifacts
59+ path : |
60+ etcd-terminal-linux-x64.tar.gz
61+ etcd-terminal-win-x64.zip
62+
63+ release :
64+ if : startsWith(github.ref, 'refs/tags/')
65+ needs : build
66+ permissions :
67+ contents : write
68+ runs-on : ubuntu-latest
69+
70+ steps :
71+ - uses : actions/checkout@v7
72+
73+ - name : Download artifacts
74+ uses : actions/download-artifact@v7
75+ with :
76+ name : artifacts
77+
78+ - name : Extract changelog entry
79+ id : changelog
80+ run : |
81+ notes=$(python3 -c "
82+ with open('src/EtcdTerminal.App/CHANGELOG.md') as f :
83+ content = f.read()
84+ entries = content.split('## [')
85+ if len(entries) > 1 :
86+ entry = entries[1]
87+ idx = entry.find('\n## [', 1)
88+ if idx > 0 :
89+ entry = entry[:idx]
90+ nl = entry.find('\n')
91+ if nl >= 0 :
92+ entry = entry[nl:]
93+ print(entry.strip())
94+ " )
95+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
96+ echo " NOTES<<$EOF" >> $GITHUB_ENV
97+ echo "$notes" >> $GITHUB_ENV
98+ echo "$EOF" >> $GITHUB_ENV
99+
100+ - name : Create release
101+ env :
102+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
103+ run : |
104+ gh release create "${{ github.ref_name }}" \
105+ --title "${{ github.ref_name }}" \
106+ --notes "$NOTES" \
107+ etcd-terminal-linux-x64.tar.gz \
108+ etcd-terminal-win-x64.zip
0 commit comments