Skip to content

Make sure submodules are available when building a release. #56

Make sure submodules are available when building a release.

Make sure submodules are available when building a release. #56

Workflow file for this run

name: Release-local
on:
push:
tags:
- v*.*.*
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
outputs:
linuxArtifact: ${{ steps.build_linux.outputs.file_name_lin }}
windowsArtifact: ${{ steps.build_windows.outputs.file_name_win }}
version: ${{ steps.get_version.outputs.version }}
strategy:
fail-fast: true
matrix:
# We use self-hosted because this action often runs out of memory on github's own servers.
#os: [self-hosted-windows, self-hosted-linux]
os: [self-hosted-windows]
include:
# Old windows configuration.
# No longer used due to memory problems on compilation.
#- {os: windows-latest, TARGET: x86_64-pc-windows-msvc, EXTENSION: zip, MIME: application/x-zip-compressed, DDISK: D}
# Self-hosted windows requires:
# - Windows 10 x64.
# - VSTools installed.
# - 2 disks (C: and E:).
- {os: self-hosted-windows, TARGET: x86_64-pc-windows-msvc, EXTENSION: zip, MIME: application/x-zip-compressed, DDISK: E}
# Self-hosted linux requires:
# - Archlinux Docker with some custom stuff.
#- {os: self-hosted-linux, TARGET: x86_64-unknown-linux-gnu, EXTENSION: tar.zst, MIME: application/tar+zstd}
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
- name: Get Version
id: get_version
uses: battila7/get-version-action@v2.2.1
#- name: Build Runcher (Linux)
# if: matrix.os == 'self-hosted-linux'
# shell: bash
# run: |
# cd /usr/src/app/_work/runcher/runcher
# cargo build --release
- name: Build Runcher (Windows)
id: build_windows
if: matrix.os == 'self-hosted-windows'
shell: pwsh
run: |
echo "file_name_win=runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}" >> $env:GITHUB_OUTPUT
${{ matrix.DDISK }}:\Craft\craft\craftenv.ps1
cd E:\runner_runcher\_work\runcher\runcher
# Build the exes in release mode.
$env:CARGO_NET_GIT_FETCH_WITH_CLI = 'true'
cargo build --release
# - name: Prepare Assets for Release (Linux)
# id: build_linux
# if: matrix.os == 'self-hosted-linux'
# run: |
# echo "file_name_lin=runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}" >> $GITHUB_OUTPUT
#
# # Go back one folder to not put the built files in the repo.
# cd /usr/src/app/_work/runcher/
#
# mkdir -p build/usr/bin/
# cp -R runcher/target/release/runcher build/usr/bin/runcher
#
# # The dark theme. May be removed in a future cleanup.
# mkdir -p build/usr/share/runcher/
# cp -R runcher/dark-theme.qss build/usr/share/runcher/dark-theme.qss
#
# # The icons.
# mkdir -p build/usr/share/runcher/icons/
# cp -R runcher/icons/* build/usr/share/runcher/icons/
#
# # The language files.
# mkdir -p build/usr/share/runcher/locale/
# cp -R runcher/locale/* build/usr/share/runcher/locale/
#
# # The UI files.
# mkdir -p build/usr/share/runcher/ui/
# cp -R runcher/ui_templates/* build/usr/share/runcher/ui/
#
# # Shortcuts.
# mkdir -p build/usr/share/applications
# cp -R runcher/install/arch/runcher.desktop build/usr/share/applications/runcher.desktop
#
# # License.
# mkdir -p build/usr/share/licenses/runcher
# cp -R runcher/LICENSE build/usr/share/licenses/runcher/LICENSE
#
# # And finally create the compressed file.
# tar --zstd -cf runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }} -C build usr
- name: Prepare Assets for Release (Windows)
if: matrix.os == 'self-hosted-windows'
run: |
cd ${{ matrix.DDISK }}:\
rm -r -fo ${{ matrix.DDISK }}:\deploy
mkdir deploy
cd deploy
mkdir runcher-release-assets
cd runcher-release-assets
# Copy Breeze icons into the release.
mkdir -p data/icons
cp "${{ matrix.DDISK }}:\Craft\bin\data\icons\breeze" "${{ matrix.DDISK }}:\deploy\runcher-release-assets\data\icons\" -recurse
cp "${{ matrix.DDISK }}:\Craft\bin\data\icons\breeze-dark" "${{ matrix.DDISK }}:\deploy\runcher-release-assets\data\icons\" -recurse
# Here we copy all the dlls required by runcher. Otherwise we'll have to manually update them on every freaking release, and for 2 months that's been a royal PITA.
mkdir designer
cp ${{ matrix.DDISK }}:\Craft\plugins\designer\*.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\designer\
mkdir iconengines
cp ${{ matrix.DDISK }}:\Craft\plugins\iconengines\KIconEnginePlugin.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\iconengines\
cp ${{ matrix.DDISK }}:\Craft\plugins\iconengines\qsvgicon.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\iconengines\
mkdir imageformats
cp ${{ matrix.DDISK }}:\Craft\plugins\imageformats\*.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\imageformats\
# TODO: Check if we have to copy the kf5 folder.
mkdir platforms
cp ${{ matrix.DDISK }}:\Craft\plugins\platforms\qwindows.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\platforms\
mkdir styles
cp ${{ matrix.DDISK }}:\Craft\plugins\styles\qwindowsvistastyle.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\styles\
cp ${{ matrix.DDISK }}:\Craft\bin\d3dcompiler_47.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\dbus-1-3.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\editorconfig.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\freetype.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\harfbuzz.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\iconv.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\icudt??.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\icuin??.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\icuuc??.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\intl-8.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\jpeg62.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5Archive.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5Codecs.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5ConfigCore.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5ConfigGui.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5ConfigWidgets.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5CoreAddons.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5GuiAddons.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5I18n.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5IconThemes.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\KF5WidgetsAddons.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libbzip2.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libcrypto*.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libEGL.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libGLESV2.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\liblzma.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libpng16.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\libssl*.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
# Are these still neccesary?
cp ${{ matrix.DDISK }}:\Craft\bin\msvcp140.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\msvcp140_1.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\msvcp140_2.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\pcre2-8.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\pcre2-16.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\Qt5DBus.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\Qt5Svg.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
# Same as before. Still neccesary?
cp ${{ matrix.DDISK }}:\Craft\bin\vcruntime140.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\vcruntime140_1.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\tiff.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\zlib1.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp ${{ matrix.DDISK }}:\Craft\bin\zstd.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
# Here we copy files generated from the compilation.
cp E:\runner_runcher\_work\runcher\runcher/target/release/runcher.exe ${{ matrix.DDISK }}:\deploy\runcher-release-assets
cp E:\runner_runcher\_work\runcher\runcher/target/release/runcher.pdb ${{ matrix.DDISK }}:\deploy\runcher-release-assets
# Workshopper for workshop and steam launch support.
cp ${{ matrix.DDISK }}:\steam_api64.dll ${{ matrix.DDISK }}:\deploy\runcher-release-assets\
cp E:\runner_runcher\_work\runcher\runcher/target/release/workshopper.exe ${{ matrix.DDISK }}:\deploy\runcher-release-assets
# TWPatcher for load order patching support.
cp E:\runner_runcher\_work\runcher\runcher/target/release/twpatcher.exe ${{ matrix.DDISK }}:\deploy\runcher-release-assets
# Here we copy assets from the repo.
mkdir icons
mkdir locale
mkdir ui
cp E:\runner_runcher\_work\runcher\runcher/LICENSE ${{ matrix.DDISK }}:\deploy\runcher-release-assets
cp E:\runner_runcher\_work\runcher\runcher/CHANGELOG.md ${{ matrix.DDISK }}:\deploy\runcher-release-assets
cp E:\runner_runcher\_work\runcher\runcher/CHANGELOG.md ${{ matrix.DDISK }}:\deploy\runcher-release-assets\CHANGELOG.txt
cp E:\runner_runcher\_work\runcher\runcher/dark-theme.qss ${{ matrix.DDISK }}:\deploy\runcher-release-assets
cp E:\runner_runcher\_work\runcher\runcher/icons/* ${{ matrix.DDISK }}:\deploy\runcher-release-assets\icons\
cp E:\runner_runcher\_work\runcher\runcher/locale/* ${{ matrix.DDISK }}:\deploy\runcher-release-assets\locale\
cp E:\runner_runcher\_work\runcher\runcher/ui_templates/* ${{ matrix.DDISK }}:\deploy\runcher-release-assets\ui\
# Execute windeployqt to add missing translations and the vcredist if needed.
${{ matrix.DDISK }}:\Craft\craft\craftenv.ps1
cd ${{ matrix.DDISK }}:\deploy\runcher-release-assets
windeployqt runcher.exe
# Remove extra files that are not really needed for execution.
rm -fo ${{ matrix.DDISK }}:\deploy\runcher-release-assets\vc_redist.x64.exe
rm -fo ${{ matrix.DDISK }}:\deploy\runcher-release-assets\icons\breeze-icons.rcc
rm -fo ${{ matrix.DDISK }}:\deploy\runcher-release-assets\icons\breeze-icons-dark.rcc
7z a runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }} .\**
#- name: Upload build artifact (Linux)
# id: upload-release-asset-linux
# if: matrix.os == 'self-hosted-linux'
# uses: actions/upload-artifact@v4
# with:
# name: runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}
# path: /usr/src/app/_work/runcher/runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}
- name: Upload build artifact (Windows)
id: upload-release-asset-windows
if: matrix.os == 'self-hosted-windows'
uses: actions/upload-artifact@v4
with:
name: runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}
path: ${{ matrix.DDISK }}:/deploy/runcher-release-assets/runcher-${{ steps.get_version.outputs.version }}-${{ matrix.TARGET }}.${{ matrix.EXTENSION }}
create_release:
name: Create Release
needs:
- build
runs-on: ubuntu-latest
outputs:
# Concatenated because it's either one or the other.
upload_url: ${{ steps.create_release_beta.outputs.upload_url }}${{ steps.create_release_stable.outputs.upload_url }}
is_beta: ${{ steps.check_version_format_bash.outputs.is_beta }}
steps:
- uses: actions/checkout@v2
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
path: ./CHANGELOG.md
- name: Check Version Format in Tag
id: check_version_format
uses: nowsprinting/check-version-format-action@v3.2.4
- name: Check the release type
id: check_version_format_bash
shell: bash
run: |
if [[ ${{ steps.check_version_format.outputs.patch }} -gt 99 ]]; then
echo "is_beta=1" >> $GITHUB_OUTPUT
else
echo "is_beta=0" >> $GITHUB_OUTPUT
fi
- name: Create Release (beta)
id: create_release_beta
if: steps.check_version_format_bash.outputs.is_beta == 1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release beta ${{ github.ref }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: true
prerelease: true
- name: Create Release (stable)
id: create_release_stable
if: steps.check_version_format_bash.outputs.is_beta == 0
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
[![become_a_patron_button](https://user-images.githubusercontent.com/15714929/40394531-2130b9ce-5e24-11e8-91a2-bbf8e6e75d21.png)][Patreon]
${{ steps.changelog_reader.outputs.changes }}
[Patreon]: https://www.patreon.com/RPFM
draft: true
prerelease: false
upload_release_assets:
name: Upload Release Assets
needs:
- build
- create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./downloads
- name: List downloads
run: |
ls -lR downloads
# TODO: Move the mimes out.
#- name: Upload Release Asset (Linux)
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: ./downloads/${{ needs.build.outputs.linuxArtifact }}/${{ needs.build.outputs.linuxArtifact }}
# asset_name: ${{ needs.build.outputs.linuxArtifact }}
# asset_content_type: application/tar+zstd
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./downloads/${{ needs.build.outputs.windowsArtifact }}/${{ needs.build.outputs.windowsArtifact }}
asset_name: ${{ needs.build.outputs.windowsArtifact }}
asset_content_type: application/x-zip-compressed