Skip to content

Commit e67a688

Browse files
committed
Building with Github Actions
1 parent b626c6c commit e67a688

File tree

7 files changed

+122
-9
lines changed

7 files changed

+122
-9
lines changed

.github/dev.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
pr: none
2-
trigger: [ master ]
2+
trigger:
3+
branches:
4+
include: [ master ]
5+
paths:
6+
exclude: [ '.github', '*.md', 'Examples' ]
37

4-
name: 4.3.1-dev.$(Rev:r)
8+
name: 4.3.2-dev.$(Rev:r)
59

610
pool:
711
vmImage: ubuntu-latest
@@ -57,4 +61,3 @@ stages:
5761
"message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\", \"commitMessage\": \"$(Release_Notes)\" }"
5862
}
5963
waitForCompletion: 'false'
60-

.github/workflows/autolock.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'Auto-Lock Issues'
22

33
on:
44
schedule:
5-
- cron: '17 2 * * *'
5+
- cron: '17 2 * * 1'
66
workflow_dispatch:
77

88
permissions:

.github/workflows/dev.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Dev build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore: [ '.**', 'Examples/**', '**.md' ]
7+
8+
env:
9+
PROJECT_PATH: src/WTelegramClient.csproj
10+
CONFIGURATION: Release
11+
RELEASE_NOTES: ${{ github.event.head_commit.message }}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 100
20+
- name: Determine version
21+
run: |
22+
git fetch --depth=100 --tags
23+
DESCR_TAG=$(git describe --tags)
24+
COMMITS=${DESCR_TAG#*-}
25+
COMMITS=${COMMITS%-*}
26+
LAST_TAG=${DESCR_TAG%%-*}
27+
NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1))-dev.$COMMITS
28+
RELEASE_VERSION=${{vars.RELEASE_VERSION}}-dev.$COMMITS
29+
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
30+
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
31+
echo "VERSION=$VERSION" >> $GITHUB_ENV
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: 8.0.x
36+
- name: Pack
37+
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
38+
# - name: Upload artifact
39+
# uses: actions/upload-artifact@v4
40+
# with:
41+
# name: packages
42+
# path: packages/*.nupkg
43+
- name: Nuget push
44+
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
45+
- name: Deployment Notification
46+
env:
47+
JSON: |
48+
{
49+
"status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }},
50+
"message": "{ \"commitId\": \"${{ github.event.head_commit.id }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"teamProjectName\": \"${{ github.event.repository.name }}\"}"
51+
}
52+
run: |
53+
curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }}

.github/workflows/release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_notes:
7+
description: 'Release notes'
8+
required: true
9+
version:
10+
description: "Release version (leave empty for automatic versioning)"
11+
12+
run-name: '📌 Release build ${{ inputs.version }}'
13+
14+
env:
15+
PROJECT_PATH: src/WTelegramClient.csproj
16+
CONFIGURATION: Release
17+
RELEASE_NOTES: ${{ inputs.release_notes }}
18+
VERSION: ${{ inputs.version }}
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write # For git tag
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 100
29+
- name: Determine version
30+
if: ${{ env.VERSION == '' }}
31+
run: |
32+
git fetch --depth=100 --tags
33+
DESCR_TAG=$(git describe --tags)
34+
LAST_TAG=${DESCR_TAG%%-*}
35+
NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1))
36+
RELEASE_VERSION=${{vars.RELEASE_VERSION}}
37+
if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi
38+
echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION
39+
echo "VERSION=$VERSION" >> $GITHUB_ENV
40+
- name: Setup .NET
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
dotnet-version: 8.0.x
44+
- name: Pack
45+
run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages
46+
# - name: Upload artifact
47+
# uses: actions/upload-artifact@v4
48+
# with:
49+
# name: packages
50+
# path: packages/*.nupkg
51+
- name: Nuget push
52+
run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json
53+
- name: Git tag
54+
run: |
55+
git tag $VERSION
56+
git push --tags

src/Client.cs

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags)
292292
/// <param name="dcId">ID of the Data Center (use negative values for media_only)</param>
293293
/// <param name="connect">Connect immediately</param>
294294
/// <returns>Client connected to the selected DC</returns>
295+
/// <remarks>⚠️ You shouldn't have to use this method unless you know what you're doing</remarks>
295296
public async Task<Client> GetClientForDC(int dcId, bool connect = true)
296297
{
297298
if (_dcSession.DataCenter?.id == dcId) return this;

src/TlsStream.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ public static async Task<TlsStream> HandshakeAsync(Stream stream, byte[] key, by
100100
static readonly byte[] TlsClientHello3 = [
101101
// 0x00, 0x00, len { len { 0x00 len { domain } } } len is 16-bit big-endian length of the following block of data
102102
0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00,
103-
0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A,/*=grease(4)*/ 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
103+
0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A/*=grease(4)*/, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
104104
0x00, 0x0b, 0x00, 0x02, 0x01, 0x00,
105105
0x00, 0x0d, 0x00, 0x12, 0x00, 0x10, 0x04, 0x03, 0x08, 0x04, 0x04, 0x01, 0x05, 0x03, 0x08, 0x05, 0x05, 0x01, 0x08, 0x06, 0x06, 0x01,
106106
0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31,
107107
0x00, 0x12, 0x00, 0x00,
108108
0x00, 0x17, 0x00, 0x00,
109109
0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02,
110110
0x00, 0x23, 0x00, 0x00,
111-
0x00, 0x2b, 0x00, 0x07, 0x06, 0x6A, 0x6A,/*=grease(6) */ 0x03, 0x04, 0x03, 0x03,
111+
0x00, 0x2b, 0x00, 0x07, 0x06, 0x6A, 0x6A/*=grease(6)*/, 0x03, 0x04, 0x03, 0x03,
112112
0x00, 0x2d, 0x00, 0x02, 0x01, 0x01,
113-
0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A,/*=grease(4) */ 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */
113+
0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A/*=grease(4)*/, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */
114114
0x44, 0x69, 0x00, 0x05, 0x00, 0x03, 0x02, 0x68, 0x32,
115115
0xff, 0x01, 0x00, 0x01, 0x00,
116116
];

src/WTelegramClient.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%
3333
</PropertyGroup>
3434

3535
<ItemGroup>
36-
<None Include="..\.github\dev.yml" Link="Data\dev.yml" />
37-
<None Include="..\.github\release.yml" Link="Data\release.yml" />
36+
<None Include="..\.github\workflows\dev.yml" Link="Data\dev.yml" />
37+
<None Include="..\.github\workflows\release.yml" Link="Data\release.yml" />
3838
<None Include="..\EXAMPLES.md" Link="Data\EXAMPLES.md" />
3939
<None Include="..\FAQ.md" Link="Data\FAQ.md" />
4040
<None Include="..\README.md" Link="Data\README.md" Pack="true" PackagePath="\" />

0 commit comments

Comments
 (0)