Move version string to a separate object file, finish build scripts, create github CI for theme installer

This commit is contained in:
exelix 2020-09-25 10:56:19 +02:00
parent c350c4422e
commit f772269ca1
10 changed files with 66 additions and 10 deletions

3
.gitattributes vendored
View File

@ -1,2 +1,5 @@
# Shell scripts should use LF
*.sh text eol=lf
# Auto detect text files and perform LF normalization
* text=auto

26
.github/workflows/InstallerBuild.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: InstallerBuild
on:
push:
branches: [ master, githubCI ]
paths:
- SwitchThemesNX/**
pull_request:
branches: [ master ]
paths:
- SwitchThemesNX/**
jobs:
InstallerBuild:
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
steps:
- name: Checkout master branch
run: git clone --recursive https://github.com/exelix11/SwitchThemeInjector.git $GITHUB_WORKSPACE
- name: Launch build script
run: |
cd $GITHUB_WORKSPACE/SwitchThemesNX/
scripts/cibuild.sh -j4
- uses: actions/upload-artifact@master
with:
name: Built
path: Built.7z

View File

@ -1,3 +1,8 @@
#!/bin/sh
set -e
# Remove the object file containing the version string
rm build/Version.o
ver=$(git describe --always --abbrev=40 --dirty)
make all "GITVER=${ver}" $@

View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
# Remove the object file containing the version string
rm build/Version.o
ver=$(git describe --always --abbrev=40 --dirty)
make all "GITVER=CI-${ver}" $@
7z a -y -mx=7 Built.7z SwitchThemesNX.nro SwitchThemesNX.elf

View File

@ -1,4 +1,5 @@
#include "TextPage.hpp"
#include "../Version.hpp"
#include "../ViewFunctions.hpp"
#include "../UI/imgui/imgui_internal.h"
@ -33,8 +34,8 @@ void TextPage::Update()
}
CreditsPage::CreditsPage() :
creditsText("NXThemes installer by exelix - " + VersionString + " - Core Ver." + SwitchThemesCommon::CoreVer +
"\nCommit: " GITVER +
creditsText("NXThemes installer by exelix - " + Version::Name + " - Core Ver." + SwitchThemesCommon::CoreVer +
'\n' + Version::Commit +
"\nSource: github.com/exelix11/SwitchThemeInjector"+
"\nDonations: ko-fi.com/exelix11\n\n")
{

View File

@ -1,5 +1,6 @@
#include "UI.hpp"
#include "../ViewFunctions.hpp"
#include "../Version.hpp"
#include "../Platform/Platform.hpp"
using namespace std;
@ -107,7 +108,7 @@ void TabRenderer::Render(int X, int Y)
}
TabRenderer::TabRenderer() :
Title("NXThemes Installer " + VersionString)
Title("NXThemes Installer " + Version::Name)
{
CurrentControl = nullptr;
}

View File

@ -0,0 +1,8 @@
#include "Version.hpp"
#ifndef GITVER
#define GITVER "Unknown version"
#endif
const std::string Version::Name = "Ver. 2.5.1";
const std::string Version::Commit = "Commit: " GITVER;

View File

@ -0,0 +1,7 @@
#pragma once
#include <string>
namespace Version {
extern const std::string Name;
extern const std::string Commit;
}

View File

@ -7,11 +7,6 @@
#include "UI/DialogPages.hpp"
#include "Platform/Platform.hpp"
#ifndef GITVER
#define GITVER "Unknown version"
#endif
const std::string VersionString = "Ver. 2.5.1";
extern std::string SystemVer;
void PushPage(IUIControlObj* page);

View File

@ -7,6 +7,7 @@
#include <filesystem>
#include <variant>
#include "Version.hpp"
#include "UI/UIManagement.hpp"
#include "UI/UI.hpp"
#include "Platform/Platform.hpp"
@ -215,7 +216,7 @@ class QuitPage : public IPage
void ShowFirstTimeHelp(bool WelcomeScr)
{
if (WelcomeScr)
DialogBlocking("Welcome to NXThemes Installer " + VersionString + "!\n\nThese pages contains some important informations, it's recommended to read them carefully.\nThis will only show up once, you can read it again from the Credits tab.");
DialogBlocking("Welcome to NXThemes Installer " + Version::Name + "!\n\nThese pages contains some important informations, it's recommended to read them carefully.\nThis will only show up once, you can read it again from the Credits tab.");
DialogBlocking(
"Custom themes CANNOT brick your console because they're installed only on the SDcard. \n"