Skip to content

Commit

Permalink
test ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
TitleHHHH authored and TitleHHHH committed Nov 18, 2023
1 parent 1f0069a commit 0b9fd0b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,22 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.100
- name: Setup Git
run: |
git config --global url."https://user:${{ secrets.GITHUB_TOKEN }}@github".insteadOf https://github
git config --global user.name HolyClientDeploy
git config --global user.email [email protected]
- name: "Git clone"
run: git clone $(git config --get remote.origin.url) -b gh-pages --depth 1 --single-branch ClickOnceArtifacts
- name: 'Run: Preview'
run: ./build.cmd Preview
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Deploy to branch: deploy"
run: |
cd ClickOnceArtifacts
git add -A
git commit -m "Test CI/CD"
git push
31 changes: 16 additions & 15 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Build : NukeBuild
readonly AbsolutePath HolyClient_Application = ArtifactsDirectory / "bin" / "HolyClient.Desktop.application";
readonly AbsolutePath ApplicationFiles = ArtifactsDirectory / "bin" / "Application Files";

readonly AbsolutePath ClickOncePreview = RootDirectory / "ClickOnceArtifacts" / "preview";
readonly AbsolutePath ClickOncePreview = RootDirectory / "ClickOnceArtifacts";



Expand All @@ -133,40 +133,41 @@ class Build : NukeBuild
x.SetProjectFile(Solution.Platfroms.HolyClient_Desktop)
.EnableNoRestore());

ClickOncePreview.CreateOrCleanDirectory();
//ClickOncePreview.CreateOrCleanDirectory();

Repository.Clone(
"https://github.com/Titlehhhh/Minecraft-Holy-Client",
ClickOncePreview,
new CloneOptions() {
BranchName = "deploy"
});
//string pathRep = Repository.Clone(
// "https://github.com/Titlehhhh/Minecraft-Holy-Client",
// ClickOncePreview,
// new CloneOptions()
// {

// BranchName = "deploy"
// });



MSBuildTasks.MSBuild(s => s

.SetTargetPath(Solution.Platfroms.HolyClient_Desktop)
.SetTargets("publish")
.SetProperty("PublishProfile", "ClickOnceProfile")
.SetProperty("PublishDir", ArtifactsDirectory / "bin"));




SetupExe.MoveToDirectory(ClickOncePreview);
HolyClient_Application.MoveToDirectory(ClickOncePreview);
ApplicationFiles.MoveToDirectory(ClickOncePreview);

PushToDeploy();
//PushToDeploy();

});

private void PushToDeploy()
{
try
{

using (var repo = new Repository(ClickOncePreview))
{
RepositoryStatus status = repo.RetrieveStatus();
Expand All @@ -187,12 +188,12 @@ private void PushToDeploy()
{
Username = GitHubActions.RepositoryOwner,
Password = GitHubActions.Token
}
}
};

var pushRefSpec = $"refs/heads/deploy";
repo.Network.Push(remote, pushRefSpec, options); //Push changes to the remote repository

}
}
catch (Exception ex)
Expand Down

0 comments on commit 0b9fd0b

Please sign in to comment.