diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml new file mode 100644 index 00000000..b3e06931 --- /dev/null +++ b/.github/workflows/beta.yml @@ -0,0 +1,55 @@ +name: Push beta branch +on: + schedule: + - cron: '0 0 * * 5' + workflow_dispatch: +jobs: + push-beta: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: 'beta' + - name: Fetch tags + run: git fetch --prune --unshallow --tags + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y/%m/%d')" + - name: Get current version + id: current-version + run: echo "::set-output name=ver::$(git describe --tags --abbrev=0 | sed 's/^.//')" + - name: Get next version + id: next-version + run: | + ver=`git describe --tags --abbrev=0` + major=$(echo $ver | sed -r 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1/') + minor=$(echo $ver | sed -r 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\2/') + patch=$(echo $ver | sed -r 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\3/') + let minor+=1 + semVer="$major.$minor.$patch" + echo "::set-output name=ver::$(echo $semVer)" + - name: Update from dev + run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git rebase -X ours origin/dev + - name: Install changelog generator + run: sudo gem install github_changelog_generator --version 1.15.2 + - name: Generate Release notes + run: github_changelog_generator --user ${{ github.repository_owner }} --project ${{ github.event.repository.name }} -t ${{ secrets.GITHUB_TOKEN }} --output temp_change.md --release-branch dev --exclude-labels invalid,duplicate --future-release ${{ steps.next-version.outputs.ver }} --since-tag `echo v${{ steps.current-version.outputs.ver }}` --max-issues 0 --no-issues true --date-format %Y/%m/%d + - name: Tweak changelogs + run: | + sed -i '$d' temp_change.md + sed -i 's/\[Quotae\]/\[Quote_a\]/' temp_change.md + echo "VERSION[${{ steps.current-version.outputs.ver }}][${{ steps.date.outputs.date }}]" | cat - temp_change.md | sed '2,6d' | sed -e '/^\*\*.*/,+1 d' | sed -r 's/\[\\#.* \(\[(.*)\]\(.*/\(\1\)/' | sed 's/^-/*/' | cat - changelog.txt > changelog_new.txt + cat CHANGELOG.md | sed '1d' >> temp_change.md + mv temp_change.md CHANGELOG.md + mv changelog_new.txt changelog.txt + - name: Update manifest.xml + run: python3 update_manifest.py --quiet --in-place --set-version=${{ steps.next-version.outputs.ver }} + + - name: Push to beta branch + run: | + git commit -am "Weekly beta-${{ steps.current-version.outputs.ver }} release" --allow-empty --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" + git push origin beta diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80ce6de5..fd9e38a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + ref: 'dev' - name: Install changelog generator run: sudo gem install github_changelog_generator --version 1.15.2 - name: Generate Release notes diff --git a/src/Modules/Main.lua b/src/Modules/Main.lua index 1345da8c..f1568b6c 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -160,7 +160,7 @@ function main:Init() end self.controls.versionLabel = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 148, -2, 0, 16, "") self.controls.versionLabel.label = function() - return "^8Version: "..launch.versionNumber..(launch.versionBranch == "dev" and " (Dev)" or "") + return "^8Version: "..launch.versionNumber..(launch.versionBranch == "dev" and " (Dev)" or launch.versionBranch == "beta" and " (Beta)" or "") end self.controls.devMode = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -26, 0, 20, "^1Dev Mode") self.controls.devMode.shown = function() @@ -516,6 +516,9 @@ function main:LoadSettings(ignoreBuild) if node.attrib.showTitlebarName then self.showTitlebarName = node.attrib.showTitlebarName == "true" end + if node.attrib.betaTest then + self.betaTest = node.attrib.betaTest == "true" + end end end end @@ -562,6 +565,7 @@ function main:SaveSettings() thousandsSeparator = self.thousandsSeparator, decimalSeparator = self.decimalSeparator, showTitlebarName = tostring(self.showTitlebarName), + betaTest = tostring(self.betaTest), } }) local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml") if not res then @@ -619,13 +623,18 @@ function main:OpenOptionsPopup() controls.titlebarName = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, 230, 160, 20, "Show build name in window title:", function(state) self.showTitlebarName = state end) + controls.betaTest = new("CheckBoxControl", {"TOPLEFT",nil,"TOPLEFT"}, 230, 182, 20, "Opt-in to weekly beta test builds:", function(state) + self.betaTest = state + end) + controls.betaTest.state = self.betaTest controls.titlebarName.state = self.showTitlebarName local initialNodePowerTheme = self.nodePowerTheme local initialThousandsSeparatorDisplay = self.showThousandsSeparators local initialTitlebarName = self.showTitlebarName local initialThousandsSeparator = self.thousandsSeparator local initialDecimalSeparator = self.decimalSeparator - controls.save = new("ButtonControl", nil, -45, 182, 80, 20, "Save", function() + local initialBetaTest = self.betaTest + controls.save = new("ButtonControl", nil, -45, 204, 80, 20, "Save", function() if controls.proxyURL.buf:match("%w") then launch.proxyURL = controls.proxyType.list[controls.proxyType.selIndex].scheme .. "://" .. controls.proxyURL.buf else @@ -642,17 +651,39 @@ function main:OpenOptionsPopup() if self.mode == "LIST" then self.modes.LIST:BuildList() end + main:SetManifestBranch(self.betaTest and "beta" or "master") main:ClosePopup() end) - controls.cancel = new("ButtonControl", nil, 45, 182, 80, 20, "Cancel", function() + controls.cancel = new("ButtonControl", nil, 45, 204, 80, 20, "Cancel", function() self.nodePowerTheme = initialNodePowerTheme self.showThousandsSeparators = initialThousandsSeparatorDisplay self.thousandsSeparator = initialThousandsSeparator self.decimalSeparator = initialDecimalSeparator self.showTitlebarName = initialTitlebarName + self.betaTest = initialBetaTest main:ClosePopup() end) - self:OpenPopup(450, 218, "Options", controls, "save", nil, "cancel") + self:OpenPopup(450, 240, "Options", controls, "save", nil, "cancel") +end + +function main:SetManifestBranch(branchName) + local xml = require("xml") + local manifestLocation = "manifest.xml" + local localManXML = xml.LoadXMLFile(manifestLocation) + if not localManXML then + manifestLocation = "../manifest.xml" + xml.LoadXMLFile(manifestLocation) + end + if localManXML and localManXML[1].elem == "PoBVersion" then + for _, node in ipairs(localManXML[1]) do + if type(node) == "table" then + if node.elem == "Version" then + node.attrib.branch = branchName + end + end + end + end + xml.SaveXMLFile(localManXML[1], manifestLocation) end function main:OpenUpdatePopup()