Skip to content

Create installer

Create installer #142

name: Create installer
on:
workflow_run:
workflows: ["Build"]
types: [completed]
# make sure this only runs on the default branch
branches: [chatterino7, "bugfix-release/**", "release/*"]
workflow_dispatch:
env:
C2_PORTABLE_INSTALLER_VERSION: "v0.1.3"
C2_PORTABLE_INSTALLER_SHA256: "1226165a328e9b1ce96ccc1b3a641fe9020708b5e2f88a486e226e2b4f259aa8"
RELEASE_NIGHTLY_INSTALLER: "OFF"
jobs:
create-installer:
runs-on: windows-latest
# Only run manually or when a build succeeds
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
qt-version: ["6.7.3"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
commit: ${{ github.sha }}
path: build/
- name: Unzip
run: 7z e -spf chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip
working-directory: build
- name: Install InnoSetup
run: choco install innosetup
- name: Add InnoSetup to path
run: echo "C:\Program Files (x86)\Inno Setup 6\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Build installer
id: build-installer
working-directory: build
run: ..\.CI\build-installer.ps1
shell: powershell
- name: Bundle portable
id: bundle-portable
working-directory: build
run: ..\.CI\bundle-portable.ps1
shell: powershell
- name: Upload installer
uses: actions/upload-artifact@v4
with:
path: build/${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
name: ${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
- name: Upload portable
uses: actions/upload-artifact@v4
with:
path: build/${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
name: ${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
- name: Create nightly release
if: ${{ contains(steps.build-installer.outputs.C2_INSTALLER_BASE_NAME, 'Nightly') && env.RELEASE_NIGHTLY_INSTALLER == 'ON' }}
uses: ncipollo/release-action@v1.14.0
with:
replacesArtifacts: true
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
artifactErrorsFailBuild: true
artifacts: |
build/${{ steps.build-installer.outputs.C2_INSTALLER_BASE_NAME }}.exe
build/${{ steps.bundle-portable.outputs.C2_PORTABLE_BASE_NAME }}.zip
prerelease: true
name: Nightly Release
tag: nightly-build
check-release:
runs-on: ubuntu-latest
needs: create-installer
outputs:
IS_TAGGED: ${{ steps.is-rel.outputs.IS_TAGGED }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- name: Check Release
id: is-rel
run: |
set +e;
git describe --exact-match --match 'v*' &> /dev/null;
echo "IS_TAGGED=$?" >> "$GITHUB_OUTPUT";
shell: bash
draft-release:
runs-on: ubuntu-latest
needs: [create-installer, check-release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # allows for tags access
- uses: actions/download-artifact@v4
with:
name: Chatterino7${{ needs.check-release.outputs.IS_TAGGED != '0' && '.Nightly' || '' }}.Installer.exe
path: build/
- uses: actions/download-artifact@v4
with:
name: Chatterino7${{ needs.check-release.outputs.IS_TAGGED != '0' && '.Nightly' || '' }}.Portable.zip
path: build/
- name: Download artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
name_is_regexp: true
name: '((^[Cc]hatterino)-[^wW].+$)|(^.+\.7z$)'
path: build/
- name: Fix Directories
working-directory: build
run: |
for file in */ ; do
mv "$file$(find "$file" -type f -printf '%f')" ".tmp.${file%/}";
rm -rf "$file";
mv ".tmp.${file%/}" "${file%/}";
done
shell: bash
- name: Fix paths
working-directory: build
run: |
ls -l
mv Chatterino-ubuntu-22.04-Qt-6.7.2.deb Chatterino-Ubuntu-22.04-Qt6.deb
mv Chatterino-ubuntu-24.04-Qt-6.7.2.deb Chatterino-Ubuntu-24.04-Qt6.deb
mv Chatterino-x86_64-Qt-6.7.2.AppImage Chatterino-x86_64-Qt6.AppImage
mv chatterino-windows-x86-64-Qt-6.7.3-symbols.pdb.7z Chatterino-Windows-debug-symbols.pdb.7z
mv chatterino-macos-Qt-6.7.1-universal.dmg Chatterino.dmg
- name: Hash files
working-directory: build
run: |
sha256sum * > sha256-checksums.txt
- name: Dry Run
if: ${{ needs.check-release.outputs.IS_TAGGED != '0' }}
run: |
echo "Dry Run"
echo "========================================"
echo "Files:"
ls -la build
echo "========================================"
echo "Sha256 sums:"
cat build/sha256-checksums.txt
- name: Get Tag
id: get-tag
if: ${{ needs.check-release.outputs.IS_TAGGED == '0' }}
run: echo "VALUE=$(git describe --exact-match --match 'v*')" >> "$GITHUB_OUTPUT"
- name: Create release
uses: ncipollo/release-action@v1.14.0
if: ${{ needs.check-release.outputs.IS_TAGGED == '0' }}
with:
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
draft: true
artifacts: "build/*"
name: ${{ steps.get-tag.outputs.VALUE }}
tag: ${{ steps.get-tag.outputs.VALUE }}