Skip to content

Commit 2f97345

Browse files
authored
Merge pull request #60 from Erol444/develop
Fix ci cd (#59)
2 parents 1982393 + 40fc38f commit 2f97345

File tree

9 files changed

+112
-48
lines changed

9 files changed

+112
-48
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: BuildFlow
2+
3+
on:
4+
pull_request:
5+
branches-ignore: [master]
6+
types: [opened, reopened, synchronize]
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
steps:
13+
- name: setup-msbuild
14+
uses: microsoft/setup-msbuild@v1
15+
16+
- name: Setup NuGet
17+
uses: NuGet/[email protected]
18+
19+
- name: 'Checkout repo'
20+
uses: actions/checkout@v2
21+
22+
- name: Navigate to Workspace
23+
run: cd $GITHUB_WORKSPACE
24+
25+
- name: Get cache
26+
uses: actions/cache@v2
27+
with:
28+
path: |
29+
packages
30+
TbsCore/obj/project.assets.json
31+
TbsCore/TbsCore.csproj.nuget.g.targets
32+
TbsCore/TbsCore.csproj.nuget.g.props.
33+
key: ${{ runner.os }}-nuget-${{ hashFiles('TbsCore/packages.lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-nuget-
36+
37+
- name: Restore Packages
38+
run: |
39+
nuget restore TbsCore/TbsCore.csproj -PackagesDirectory packages
40+
nuget restore TravBotSharp/TbsWinForms.csproj -PackagesDirectory packages
41+
42+
- name: Build Bot
43+
run: |
44+
msbuild.exe TravBotSharp.sln /t:TbsWinForms /nologo /nr:false /p:DeleteExistingFiles=True /p:platform="Any CPU" /p:configuration="Release" /m /p:BuildProjectReferences=true /p:BUILD_NUMBER=30.4.1975.0
45+
46+
- name: Upload a Build Artifact
47+
uses: actions/upload-artifact@v2
48+
with:
49+
name: TBS-Build
50+
path: TravBotSharp\bin\Release
51+
if-no-files-found: error
52+
53+
- name: Comment on PR when success
54+
uses: actions/[email protected]
55+
if: |
56+
github.event_name == 'pull_request' && success()
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
script: |
60+
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
61+
github.issues.createComment({ issue_number, owner, repo, body: "Congratulation this commit was built successfully. Check detail [here](https://github.com/Erol444/TravianBotSharp/actions/runs/${{ github.run_id }}?check_suite_focus=true)" });
62+
63+
- name: Comment on PR when fail
64+
uses: actions/[email protected]
65+
if: |
66+
github.event_name == 'pull_request' && failure()
67+
with:
68+
github-token: ${{ secrets.GITHUB_TOKEN }}
69+
script: |
70+
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
71+
github.issues.createComment({ issue_number, owner, repo, body: "There is error while building this commit. Check detail [here](https://github.com/Erol444/TravianBotSharp/actions/runs/${{ github.run_id }}?check_suite_focus=true)" });
72+

.github/workflows/pre-release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: PreRelease
1+
name: PreReleaseFlow
22

33
on:
44
pull_request:
5-
types: [closed]
5+
branches: develop
6+
types: closed
67
workflow_dispatch:
78

89
jobs:
@@ -13,14 +14,16 @@ jobs:
1314
version: ${{ steps.semvers.outputs.patch }}
1415
changelog: ${{ steps.Changelog.outputs.changelog }}
1516
steps:
16-
- uses: actions/checkout@v2
17-
18-
- run: git fetch --prune --unshallow --tags
19-
2017
- uses: docker://agilepathway/pull-request-label-checker:latest
2118
with:
2219
one_of: pre-release
23-
repo_token: ${{ secrets.GITHUB_TOKEN }}
20+
repo_token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: 'Checkout repo'
23+
uses: actions/checkout@v2
24+
25+
- name: 'Update tag'
26+
run: git fetch --prune --unshallow --tags
2427

2528
- name: 'Get Previous tag'
2629
id: previoustag
@@ -35,12 +38,10 @@ jobs:
3538
- name: 'Create changelog'
3639
id: Changelog
3740
run: |
38-
git branch --show-current
3941
changelog=$(git log --no-merges --pretty=format:'- %s' ${{ steps.previoustag.outputs.tag }}..HEAD --reverse)
4042
changelog="${changelog//'%'/'%25'}"
4143
changelog="${changelog//$'\n'/'%0A'}"
4244
changelog="${changelog//$'\r'/'%0D'}"
43-
echo "$changelog"
4445
echo "::set-output name=changelog::$changelog"
4546
4647
build:
@@ -113,7 +114,7 @@ jobs:
113114
body: |
114115
**Changelog**:
115116
${{needs.version.outputs.changelog}}
116-
117+
117118
artifacts: TBS-${{needs.version.outputs.version}}.zip
118119
token: ${{ secrets.GITHUB_TOKEN }}
119120
Discord:

.github/workflows/release.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: CI - Master
1+
name: ReleaseFlow
22

33
on:
44
pull_request:
5-
types: [closed]
5+
branches: master
6+
types: closed
67
workflow_dispatch:
78

89
jobs:
@@ -13,14 +14,16 @@ jobs:
1314
version: ${{ steps.semvers.outputs.minor }}
1415
changelog: ${{ steps.Changelog.outputs.changelog }}
1516
steps:
16-
- uses: actions/checkout@v2
17-
1817
- uses: docker://agilepathway/pull-request-label-checker:latest
1918
with:
2019
one_of: release
21-
repo_token: ${{ secrets.GITHUB_TOKEN }}
20+
repo_token: ${{ secrets.GITHUB_TOKEN }}
2221

23-
- run: git fetch --prune --unshallow --tags
22+
- name: 'Checkout repo'
23+
uses: actions/checkout@v2
24+
25+
- name: 'Update tag'
26+
run: git fetch --prune --unshallow --tags
2427

2528
- name: 'Get latest tag'
2629
id: latesttag
@@ -37,26 +40,25 @@ jobs:
3740
- name: 'Create changelog'
3841
id: Changelog
3942
run: |
40-
git branch --show-current
4143
last=$(git log --merges --grep='develop' --first-parent master --pretty=format:"%h" | sed -n '2p')
4244
changelog=$(git log --no-merges --pretty=format:'- %s' $last..HEAD --reverse)
4345
changelog="${changelog//'%'/'%25'}"
4446
changelog="${changelog//$'\n'/'%0A'}"
4547
changelog="${changelog//$'\r'/'%0D'}"
46-
echo "$changelog"
4748
echo "::set-output name=changelog::$changelog"
4849
build:
4950
runs-on: windows-latest
5051
needs: version
5152
steps:
5253
- name: setup-msbuild
53-
uses: microsoft/setup-msbuild@v1
54-
55-
- uses: actions/checkout@v2
54+
uses: microsoft/setup-msbuild@v1
5655

5756
- name: Setup NuGet
5857
uses: NuGet/[email protected]
5958

59+
- name: 'Checkout repo'
60+
uses: actions/checkout@v2
61+
6062
- name: Navigate to Workspace
6163
run: cd $GITHUB_WORKSPACE
6264

@@ -68,9 +70,9 @@ jobs:
6870
TbsCore/obj/project.assets.json
6971
TbsCore/TbsCore.csproj.nuget.g.targets
7072
TbsCore/TbsCore.csproj.nuget.g.props.
71-
key: ${{ runner.os }}-nuget3-${{ hashFiles('TbsCore/packages.lock.json') }}
73+
key: ${{ runner.os }}-nuget-${{ hashFiles('TbsCore/packages.lock.json') }}
7274
restore-keys: |
73-
${{ runner.os }}-nuget3-
75+
${{ runner.os }}-nuget-
7476
7577
- name: Restore Packages
7678
run: |
@@ -120,17 +122,19 @@ jobs:
120122
runs-on: ubuntu-latest
121123
needs: [release, version]
122124
steps:
123-
- run: |
125+
- name: Ping @everyone
126+
run: |
124127
curl --header "Content-Type: application/json" --data "{\"content\": \"@everyone\"}" "${{ secrets.DISCORD_BOT }}"
125128
- name: Send to discord server
126129
uses: sarisia/actions-status-discord@v1
127130
with:
128131
webhook: ${{ secrets.DISCORD_BOT }}
129132
title: New release
130-
nodetail: retrue
133+
nodetail: true
131134
description: |
132135
Version `TBS-${{needs.version.outputs.version}}`
133136
Click [here](https://github.com/Erol444/TravianBotSharp/releases/tag/${{needs.version.outputs.version}}) to download!
137+
134138
**Changelog**:
135139
${{needs.version.outputs.changelog}}
136140
Clear:

TbsCore/Models/Access/Access.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ namespace TbsCore.Models.Access
44
{
55
public class Access : AccessRaw
66
{
7-
/// <summary>
8-
/// Random selected user agent for this access
9-
/// </summary>
10-
public string UserAgent { get; set; }
117
/// <summary>
128
/// Is this account sitter. Used for functionality like changing village name
139
/// </summary>
1410
public bool IsSittering { get; set; }
11+
1512
/// <summary>
1613
/// When was this access last used
1714
/// </summary>
1815
public DateTime LastUsed { get; set; }
16+
1917
/// <summary>
2018
/// If the access is ok
2119
/// </summary>

TbsCore/Models/Access/AccessInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public void AddNewAccess(AccessRaw raw)
4646
ProxyUsername = raw.ProxyUsername,
4747
ProxyPassword = raw.ProxyPassword,
4848
IsSittering = false,
49-
UserAgent = RandomUserAgent.RandomUa.RandomUserAgent,
5049
LastUsed = DateTime.MinValue
5150
};
5251

TbsCore/TbsCore.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
<PackageReference Include="HtmlAgilityPack" Version="1.11.23" />
2121
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.10" />
2222
<PackageReference Include="Octokit" Version="0.50.0" />
23-
<PackageReference Include="RandomUserAgent" Version="1.1.2" />
24-
<PackageReference Include="RestSharp" Version="106.12.0" />
23+
<PackageReference Include="RestSharp" Version="106.13.0" />
2524
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
2625
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="95.0.4638.1700" />
2726
<PackageReference Include="Serilog" Version="2.10.0" />

TbsCore/packages.lock.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@
4949
"resolved": "0.50.0",
5050
"contentHash": "J5vqespSvjxIAAtjG1Tc6ghBqyfRgDJtKnk/ifi4N0hD/f3JbPwyEDRT+Eelu/bS4C4M6mu5gt1WJqar+fByzg=="
5151
},
52-
"RandomUserAgent": {
53-
"type": "Direct",
54-
"requested": "[1.1.2, )",
55-
"resolved": "1.1.2",
56-
"contentHash": "jj0nKiIZaApcvj6tUv5RJn0rAznpz19ncN1SP0mqZhWf+m2DEcfqTTCT2ZKOXJ7HXNprlH7X18gTkhFFu16S+Q=="
57-
},
5852
"RestSharp": {
5953
"type": "Direct",
60-
"requested": "[106.12.0, )",
61-
"resolved": "106.12.0",
62-
"contentHash": "irOsQHe5nTJB0BKxGQnTX1dsgCPl5dLTxvL7gbl98JiFPiHMN4wpFyUG/66ZpaFCsIrPKh6XwozWXlwYe9JwYQ=="
54+
"requested": "[106.13.0, )",
55+
"resolved": "106.13.0",
56+
"contentHash": "vwUdmmtC5vtePeNfBWnFcixBF2KjUeVv3ss4ZFzCIkOf7NB7W/9qX8JNZD9DOrz2yGk4AJW8k9znwgPZhnoiNg=="
6357
},
6458
"Selenium.WebDriver": {
6559
"type": "Direct",

TravBotSharp/TbsWinForms.csproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,8 @@
219219
</Reference>
220220
<Reference Include="PresentationCore" />
221221
<Reference Include="PresentationFramework" />
222-
<Reference Include="RandomUserAgent, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
223-
<HintPath>..\packages\RandomUserAgent.1.1.2\lib\netstandard2.0\RandomUserAgent.dll</HintPath>
224-
</Reference>
225-
<Reference Include="RestSharp, Version=106.11.7.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
226-
<HintPath>..\packages\RestSharp.106.11.7\lib\net452\RestSharp.dll</HintPath>
222+
<Reference Include="RestSharp, Version=106.13.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
223+
<HintPath>..\packages\RestSharp.106.13.0\lib\net452\RestSharp.dll</HintPath>
227224
</Reference>
228225
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
229226
<HintPath>..\packages\Serilog.2.10.0\lib\net46\Serilog.dll</HintPath>
@@ -315,7 +312,7 @@
315312
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
316313
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
317314
</Reference>
318-
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
315+
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
319316
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
320317
<Private>True</Private>
321318
<Private>True</Private>

TravBotSharp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
3636
<package id="Octokit" version="0.50.0" targetFramework="net461" />
3737
<package id="RandomUserAgent" version="1.1.2" targetFramework="net461" />
38-
<package id="RestSharp" version="106.12.0" targetFramework="net461" />
38+
<package id="RestSharp" version="106.13.0" targetFramework="net461" />
3939
<package id="Selenium.WebDriver" version="3.141.0" targetFramework="net472" />
4040
<package id="Selenium.WebDriver.ChromeDriver" version="95.0.4638.1700" targetFramework="net461" />
4141
<package id="Serilog" version="2.10.0" targetFramework="net461" />

0 commit comments

Comments
 (0)