Skip to content

Commit

Permalink
Script to make an installer
Browse files Browse the repository at this point in the history
  • Loading branch information
EricKotato committed May 14, 2020
1 parent 667a152 commit 1f00171
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 12 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ jobs:
return (result == -1 ? false : result)
}
function parseInstaller(s) {
let namePattern = /^install(?:er)?$/i;
let result = parseBoolOption(s, namePattern);
return (result == -1 ? false : result)
}
console.log("Current description:");
console.log(context.payload.release.body);
Expand All @@ -113,6 +119,7 @@ jobs:
update: parseUpdate(context.payload.release.body),
packer: parsePacker(context.payload.release.body),
telegram: parseTelegramUploader(context.payload.release.body),
installer: parseInstaller(context.payload.release.body),
};
console.log("Parsed parameters:");
Expand Down
60 changes: 49 additions & 11 deletions .github/workflows/win-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ jobs:
path: ${{ env.REPO_NAME }}
ref: ${{ github.event.client_payload.options.ref }}

- name: Parse current version.
shell: bash
run: |
_VERSION=$(cat "${{ env.REPO_NAME }}/Telegram/SourceFiles/kotato/version.h" | grep "AppKotatoVersion " | awk '{print $5}' | sed 's/.$//')
_VERSIONSTR=$(cat "${{ env.REPO_NAME }}/Telegram/SourceFiles/kotato/version.h" | grep "AppKotatoVersionStr " | awk '{print $5}' | sed 's/.$//')
_ISBETA=$(cat "${{ env.REPO_NAME }}/Telegram/SourceFiles/core/version.h" | grep "AppBetaVersion " | awk '{print $5}' | sed 's/.$//')
_BETA_SWITCH=""
_VERSIONSTRFULL=${_VERSIONSTR}
test "$_ISBETA" == "true" && _BETA_SWITCH=" -beta"
test $(awk -F"." '{print NF-1}' <<< "${_VERSIONSTR}") < 2 && _VERSIONSTRFULL="${_VERSIONSTR}.0"
echo "::set-env name=PACKER_VERSION::${_VERSION}"
echo "::set-env name=PACKER_BETA::${_BETA_SWITCH}"
echo "::set-env name=INSTALLER_VERSION::${_VERSIONSTR}"
echo "::set-env name=INSTALLER_VERSION_FULL::${_VERSIONSTRFULL}"
- name: Clone scripts.
if: >
env.ONLY_CACHE == 'false'
Expand Down Expand Up @@ -385,19 +400,42 @@ jobs:
TELETHON_SESSION: ${{ secrets.TELETHON_SESSION }}
run: python buildscripts/scripts/uploader.py "@ktgbuilds" "${{ env.REPO_NAME }}/artifact/${{ env.ARTIFACT_NAME }}"

- name: Parse built version.
- name: Make installer.
if: >
env.ONLY_CACHE == 'false'
&& github.event.client_payload.options.update
&& github.event.client_payload.options.packer
shell: bash
run: |
_VERSION=$(cat "${{ env.REPO_NAME }}/Telegram/SourceFiles/kotato/version.h" | grep "AppKotatoVersion " | awk '{print $5}' | sed 's/.$//')
_ISBETA=$(cat "${{ env.REPO_NAME }}/Telegram/SourceFiles/core/version.h" | grep "AppBetaVersion " | awk '{print $5}' | sed 's/.$//')
_BETA_SWITCH=""
test "$_ISBETA" == "true" && _BETA_SWITCH=" -beta"
echo "::set-env name=PACKER_VERSION::${_VERSION}"
echo "::set-env name=PACKER_BETA::${_BETA_SWITCH}"
&& github.event.client_payload.options.installer
run: >
iscc
/DReleasePath=$REPO_NAME\build\bin
/DMyAppVersion=${{ env.INSTALLER_VERSION }}
/DMyAppVersionFull=${{ env.INSTALLER_VERSION_FULL }}
"$REPO_NAME\Telegram\build\setup.iss"
- name: Upload installer asset.
id: upload-installer-asset
if: >
env.ONLY_CACHE == 'false'
&& github.event.client_payload.options.release_url
&& github.event.client_payload.options.installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ github.event.client_payload.options.release_url }}
asset_path: ./${{ env.REPO_NAME }}/build/bin/ksetup.${{ env.INSTALLER_VERSION_FULL }}.exe
asset_name: ksetup.${{ env.INSTALLER_VERSION_FULL }}.exe
asset_content_type: application/octet-stream

- name: Upload installer to Telegram.
if: >
env.ONLY_CACHE == 'false'
&& github.event.client_payload.options.telegram
&& github.event.client_payload.options.installer
env:
TELETHON_API_ID: ${{ secrets.TELETHON_API_ID }}
TELETHON_API_HASH: ${{ secrets.TELETHON_API_HASH }}
TELETHON_SESSION: ${{ secrets.TELETHON_SESSION }}
run: python buildscripts/scripts/uploader.py "@ktgbuilds" "${{ env.REPO_NAME }}/build/bin/ksetup.${{ env.INSTALLER_VERSION_FULL }}.exe"

- name: Package update.
if: >
Expand Down
7 changes: 6 additions & 1 deletion docs/release_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ Aliases: `upload to tg`, `uploads to telegram`, `uploads to tg`, `telegram`, `tg

Boolean parameter. If enabled:

* uploads built binaries to [@ktgbuilds](https://t.me/ktgbuilds);
* uploads built binaries to [@ktgbuilds](https://t.me/ktgbuilds) (including installers);
* uploads update files to [@ktghbcfiles](https://t.me/ktghbcfiles) if autoupdater and packer enabled.

### Installer

Aliases: `install`.

Boolean parameter to package binaries into installer file. Effective only on Windows.

0 comments on commit 1f00171

Please sign in to comment.