Skip to content

Commit 84958c9

Browse files
authored
Merge branch 'master' into feature/repo-dirty-flag
2 parents d91864f + 124b89c commit 84958c9

File tree

8 files changed

+46
-21
lines changed

8 files changed

+46
-21
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
strategy:
104104
matrix:
105105
os: [linux]
106-
targetFramework: [2.1, 3.1]
106+
targetFramework: [3.1]
107107
distro: [alpine.3.10-x64, centos.7-x64, debian.9-x64, fedora.30-x64, ubuntu.16.04-x64, ubuntu.18.04-x64]
108108
fail-fast: false
109109

@@ -233,7 +233,7 @@ jobs:
233233
strategy:
234234
matrix:
235235
os: [linux]
236-
targetFramework: [2.1, 3.1]
236+
targetFramework: [3.1]
237237
distro: [alpine.3.10-x64, centos.7-x64, debian.9-x64, fedora.30-x64, ubuntu.16.04-x64, ubuntu.18.04-x64]
238238
fail-fast: false
239239

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ stages:
6060
name: Linux
6161
vmImage: 'ubuntu-latest'
6262
distros: [ 'alpine.3.10-x64', 'centos.7-x64', 'debian.9-x64', 'fedora.30-x64', 'ubuntu.16.04-x64', 'ubuntu.18.04-x64' ]
63-
dotnetVersions: [ '2.1', '3.1' ]
63+
dotnetVersions: [ '3.1' ]
6464

6565
- stage: Docker
6666
displayName: 'Docker Build & Test'
@@ -72,7 +72,7 @@ stages:
7272
name: Linux
7373
vmImage: 'ubuntu-latest'
7474
distros: [ 'alpine.3.10-x64', 'centos.7-x64', 'debian.9-x64', 'fedora.30-x64', 'ubuntu.16.04-x64', 'ubuntu.18.04-x64' ]
75-
dotnetVersions: [ '2.1', '3.1' ]
75+
dotnetVersions: [ '3.1' ]
7676

7777
- stage: Publish
7878
displayName: 'Publish'

src/Docker/docker.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"linux": {
3-
"2.1": [
4-
"alpine.3.10-x64",
5-
"centos.7-x64",
6-
"debian.9-x64",
7-
"fedora.30-x64",
8-
"ubuntu.16.04-x64",
9-
"ubuntu.18.04-x64"
10-
],
113
"3.1": [
124
"alpine.3.10-x64",
135
"centos.7-x64",
@@ -18,9 +10,6 @@
1810
]
1911
},
2012
"windows": {
21-
"2.1": [
22-
"nanoserver"
23-
],
2413
"3.1": [
2514
"nanoserver"
2615
]

src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void GetCurrentBranchShouldHandlePullRequests()
9797
}
9898

9999
[TestCase("Something", "1.0.0",
100-
"::set-env name=GitVersion_Something::1.0.0")]
100+
"\"GitVersion_Something=1.0.0\" >> $GITHUB_ENV")]
101101
public void GetSetParameterMessage(string key, string value, string expectedResult)
102102
{
103103
// Assert
@@ -141,7 +141,7 @@ public void ShouldWriteIntegration()
141141
"Executing GenerateSetVersionMessage for 'GitHubActions'.",
142142
"",
143143
"Executing GenerateBuildLogOutput for 'GitHubActions'.",
144-
"::set-env name=GitVersion_Major::1.0.0"
144+
"\"GitVersion_Major=1.0.0\" >> $GITHUB_ENV"
145145
};
146146

147147
string.Join(Environment.NewLine, list)

src/GitVersionCore.Tests/Core/RepositoryExtensionsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ private class TestableBranchCollection : BranchCollection
5252
private readonly IRepository repository;
5353
public TestableBranchCollection(IRepository repository)
5454
{
55+
this.repository = repository;
5556
}
5657

5758
IDictionary<string, Branch> branches = new Dictionary<string, Branch>();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using GitTools.Testing;
2+
using NUnit.Framework;
3+
4+
namespace GitVersionCore.Tests.IntegrationTests
5+
{
6+
[TestFixture]
7+
public class TagCheckoutScenarios
8+
{
9+
[Test]
10+
public void GivenARepositoryWithSingleCommit()
11+
{
12+
using var fixture = new EmptyRepositoryFixture();
13+
const string taggedVersion = "1.0.3";
14+
fixture.Repository.MakeATaggedCommit(taggedVersion);
15+
fixture.Checkout(taggedVersion);
16+
17+
fixture.AssertFullSemver(taggedVersion);
18+
}
19+
20+
[Test]
21+
public void GivenARepositoryWithSingleCommitAndSingleBranch()
22+
{
23+
using var fixture = new EmptyRepositoryFixture();
24+
const string taggedVersion = "1.0.3";
25+
fixture.Repository.MakeATaggedCommit(taggedVersion);
26+
fixture.BranchTo("task1");
27+
fixture.Checkout(taggedVersion);
28+
29+
fixture.AssertFullSemver(taggedVersion);
30+
}
31+
}
32+
}

src/GitVersionCore/BuildAgents/GitHubActions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ public override string GenerateSetVersionMessage(VersionVariables variables)
2323

2424
public override string[] GenerateSetParameterMessage(string name, string value)
2525
{
26-
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-environment-variable-set-env
26+
// https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
2727
// Example
28-
// echo "::set-env name=action_state::yellow"
28+
// echo "name=action_state::yellow >> $GITHUB_ENV"
2929

3030
if (!string.IsNullOrWhiteSpace(value))
3131
{
3232
var key = $"GitVersion_{name}";
3333

3434
return new[]
3535
{
36-
$"::set-env name={key}::{value}"
36+
$"\"{key}={value}\" >> $GITHUB_ENV"
3737
};
3838
}
3939

src/GitVersionCore/VersionCalculation/NextVersionCalculator.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public SemanticVersion FindVersion()
3535
log.Info($"Current commit is tagged with version {context.CurrentCommitTaggedVersion}, " +
3636
"version calculation is for metadata only.");
3737
}
38-
EnsureHeadIsNotDetached(context);
38+
else
39+
{
40+
EnsureHeadIsNotDetached(context);
41+
}
3942

4043
SemanticVersion taggedSemanticVersion = null;
4144

0 commit comments

Comments
 (0)