Skip to content

Commit

Permalink
Merge pull request #4 from Aytackydln/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
diogotr7 authored Jan 10, 2022
2 parents 37aed5c + 4a2fe5e commit 142b1a1
Show file tree
Hide file tree
Showing 8 changed files with 622 additions and 449 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/aurora-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Aurora CD

on:
push:
branches: [ dev ]

jobs:

build:

strategy:
matrix:
configuration: [Release]

runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

env:
Solution_Name: Project-Aurora/Project-Aurora.sln

steps:
- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}

- uses: rishabhgupta/split-by@v1
id: split
with:
string: ${{github.repository}}
split-by: '/'
- run: |
echo "${{github.repository}}"
- run: |
echo "${{ steps.split.outputs._0}}"
- run: |
echo "${{ steps.split.outputs._1}}"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Build
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration
env:
APPVEYOR_BUILD_VERSION: v${{steps.buildnumber.outputs.build_number}}
OWNER: ${{ steps.split.outputs._0 }}
REPOSITORY: ${{ steps.split.outputs._1 }}
Configuration: ${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
#- name: Decode the pfx
# run: |
# $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
# $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
# [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)

# Create the app package by building and packaging the Windows Application Packaging project
- name: Building the installer
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" /DEXTERNAL_VERSION=${{steps.buildnumber.outputs.build_number}} Installer\installer.iss
shell: cmd

- name: Archive Release
uses: vimtor/action-zip@v1
with:
files: Build\Release\
dest: Aurora-v${{steps.buildnumber.outputs.build_number}}.zip

- name: Installer Release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "Aurora-setup-v${{steps.buildnumber.outputs.build_number}}.exe"
tag: v${{steps.buildnumber.outputs.build_number}}
overwrite: false
prerelease: true

- name: Zip Release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Aurora-v${{steps.buildnumber.outputs.build_number}}.zip
tag: v${{steps.buildnumber.outputs.build_number}}
overwrite: false
prerelease: true
104 changes: 104 additions & 0 deletions .github/workflows/aurora-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Aurora CD

on:
push:
branches: [ master ]

jobs:

build:

strategy:
matrix:
configuration: [Release]

runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

env:
Solution_Name: Project-Aurora/Project-Aurora.sln

steps:
- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.github_token}}

- uses: rishabhgupta/split-by@v1
id: split
with:
string: ${{github.repository}}
split-by: '/'
- run: |
echo "${{github.repository}}"
- run: |
echo "${{ steps.split.outputs._0}}"
- run: |
echo "${{ steps.split.outputs._1}}"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Build
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration
env:
APPVEYOR_BUILD_VERSION: v${{steps.buildnumber.outputs.build_number}}
OWNER: ${{ steps.split.outputs._0 }}
REPOSITORY: ${{ steps.split.outputs._1 }}
Configuration: ${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
#- name: Decode the pfx
# run: |
# $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
# $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
# [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)

# Create the app package by building and packaging the Windows Application Packaging project
- name: Building the installer
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" /DEXTERNAL_VERSION=${{steps.buildnumber.outputs.build_number}} Installer\installer.iss
shell: cmd

- name: Archive Release
uses: vimtor/action-zip@v1
with:
files: Build\Release\
dest: Aurora-v${{steps.buildnumber.outputs.build_number}}.zip

- name: Installer Release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "Aurora-setup-v${{steps.buildnumber.outputs.build_number}}.exe"
tag: v${{steps.buildnumber.outputs.build_number}}
overwrite: false

- name: Zip Release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Aurora-v${{steps.buildnumber.outputs.build_number}}.zip
tag: v${{steps.buildnumber.outputs.build_number}}
overwrite: false
10 changes: 7 additions & 3 deletions Project-Aurora/Aurora-Updater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Security.Principal;
using System.Windows.Forms;
using System.Linq;
using System.Reflection;
using Version = SemVer.Version;

namespace Aurora_Updater
Expand Down Expand Up @@ -82,10 +83,13 @@ static void Main(string[] args)
MessageBoxButtons.OK);
return;
}
versionMajor = new Version(_maj, true);
versionMajor = new Version(_maj.TrimStart('v') + ".0.0", true);

string owner = FileVersionInfo.GetVersionInfo(auroraPath).CompanyName;
string repository = FileVersionInfo.GetVersionInfo(auroraPath).ProductName;

//Initialize UpdateManager
StaticStorage.Manager = new UpdateManager(versionMajor);
StaticStorage.Manager = new UpdateManager(versionMajor, owner, repository);

//Check if update retrieval was successful.
if (StaticStorage.Manager.updateState == UpdateStatus.Error)
Expand All @@ -109,7 +113,7 @@ static void Main(string[] args)
}
else
{
Version latestV = new Version(StaticStorage.Manager.LatestRelease.TagName.TrimStart('v'), true);
Version latestV = new Version(StaticStorage.Manager.LatestRelease.TagName.TrimStart('v') + ".0.0", true);

if (latestV > versionMajor)
{
Expand Down
13 changes: 8 additions & 5 deletions Project-Aurora/Aurora-Updater/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public class UpdateManager
private GitHubClient gClient = new GitHubClient(new ProductHeaderValue("aurora-updater"));
public Release LatestRelease;

public UpdateManager(Version version)
public UpdateManager(Version version, string author, string repoName)
{
LoadSettings();
PerformCleanup();
FetchData(version);
FetchData(version, author, repoName);
}

public void LoadSettings()
Expand Down Expand Up @@ -109,20 +109,23 @@ public int GetTotalProgress()
return (int)((downloadProgess + extractProgess) / 2.0f * 100.0f);
}

private bool FetchData(Version version)
private bool FetchData(Version version, string owner, string repositoryName)
{
try
{
if (Config.GetDevReleases || !String.IsNullOrWhiteSpace(version.PreRelease))
LatestRelease = gClient.Repository.Release.GetAll("antonpup", "Aurora", new ApiOptions { PageCount = 1, PageSize = 1 }).Result[0];
LatestRelease = gClient.Repository.Release.GetAll(owner, repositoryName, new ApiOptions { PageCount = 1, PageSize = 1 }).Result[0];
else
LatestRelease = gClient.Repository.Release.GetLatest("antonpup", "Aurora").Result;
LatestRelease = gClient.Repository.Release.GetLatest(owner, repositoryName).Result;

//Console.WriteLine(reply);
}
catch (Exception exc)
{
updateState = UpdateStatus.Error;
MessageBox.Show(
$"Could not find update.\r\nError:\r\n{exc}",
"Aurora Updater - Error");
return false;
}

Expand Down
8 changes: 6 additions & 2 deletions Project-Aurora/Project-Aurora/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
<PropertyGroup>
<Title>Aurora</Title>
<Description>Unified Lighting Effects across different RGB devices</Description>
<Product>Aurora</Product>
<Copyright>Copyright © 2017</Copyright>

<AssemblyVersion>1.0.0.0</AssemblyVersion>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>

<FileVersion Condition=" '$(FileVersion)' == '' ">$(APPVEYOR_BUILD_VERSION)</FileVersion>
<FileVersion Condition=" '$(FileVersion)' == '' ">0.8.1</FileVersion>
<FileVersion Condition=" '$(FileVersion)' == '' ">v0</FileVersion>
<Company>$(OWNER)</Company>
<Company Condition=" '$(Company)' == '' ">Aurora-RGB</Company>
<Product>$(REPOSITORY)</Product>
<Product Condition=" '$(Product)' == '' ">Aurora</Product>

</PropertyGroup>

Expand Down
Loading

0 comments on commit 142b1a1

Please sign in to comment.