fix the issue of unwanted newlines in version/channel files, ugh #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [master, dependabot/*] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version (full number only, higher than last beta version)' | |
required: true | |
type: number | |
jobs: | |
build: | |
runs-on: windows-2022 | |
name: "Build" | |
env: | |
BME_CHANNEL: ${{ github.event_name == 'workflow_dispatch' && 'release' || 'staging' }} | |
BUILD_DIR: ${{ github.event_name == 'workflow_dispatch' && 'x64-Release' || 'x64-Staging' }} | |
BUILD_CONFIGURATION: ${{ github.event_name == 'workflow_dispatch' && 'Release' || 'Staging' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Create channel file | |
run: echo "${{ env.BME_CHANNEL }}" | Out-File -Encoding ascii ./installer/source/bme/bme_channel.txt -NoNewline | |
- name: Override version file (release only) | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "${{ inputs.version }}" | Out-File -Encoding ascii ./bme_version.txt -NoNewline | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: x64 | |
vs-prerelease: true | |
- name: Generate project files (premake) | |
run: premake/premake5 vs2022 --ci-build=${{ env.BME_CHANNEL }} | |
- name: Build ZIP and embed it in BSP | |
run: | | |
./copy_scripts_to_r1_modsrc.bat | |
./build_assets.bat | |
- name: Compile | |
id: compile | |
run: msbuild build\bme.sln -m -p:Configuration=${{ env.BUILD_CONFIGURATION }} | |
- name: Get final BME version | |
run: echo "BME_VERSION=$(Get-Content ./build/version.txt)" >> $env:GITHUB_ENV | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: | | |
build/bin/${{ env.BUILD_DIR }}/*.dll | |
build/bin/${{ env.BUILD_DIR }}/*.exe | |
build/bin/${{ env.BUILD_DIR }}/*.pdb | |
build/bin/${{ env.BUILD_DIR }}/*.zip | |
- name: Setup Sentry CLI | |
if: github.ref == 'refs/heads/master' | |
uses: mathieu-bour/setup-sentry-cli@v2 | |
with: | |
token: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
organization: ${{ secrets.SENTRY_ORG }} | |
project: ${{ secrets.SENTRY_PROJECT }} | |
- name: Create Sentry release | |
if: github.ref == 'refs/heads/master' | |
run: | | |
sentry-cli releases set-commits "bme-v${{ env.BME_VERSION }}" --auto --ignore-missing | |
sentry-cli releases new "bme-v${{ env.BME_VERSION }}" | |
sentry-cli releases deploys "bme-v${{ env.BME_VERSION }}" new -e ${{ env.BME_CHANNEL }} | |
- name: "Upload pdb and executables to Sentry" | |
if: github.ref == 'refs/heads/master' | |
run: | | |
$files_to_upload = Get-ChildItem -Path build\bin -Recurse -Include ("*.pdb", "*.dll", "*.exe") | |
echo "Files to upload:" $files_to_upload | |
sentry-cli upload-dif --include-sources $files_to_upload | |
- name: Copy built files to installer dirs | |
run: | | |
copy ./build/bin/${{ env.BUILD_DIR }}/bme.dll ./installer/source/bme/bme.dll | |
copy ./build/bin/${{ env.BUILD_DIR }}/Titanfall_alt.exe ./installer/source/Titanfall_alt.exe | |
md ./installer/source/bin/x64_retail | |
copy ./build/bin/${{ env.BUILD_DIR }}/launcher.dll ./installer/source/bin/x64_retail/launcher.dll | |
- name: Build installer | |
run: iscc installer/installer_simple2.iss /DMyAppVersion=${{ env.BME_VERSION }} | |
- name: Upload installer artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: installer | |
path: installer/bme_installer.exe | |
- name: Create release | |
if: github.event_name == 'workflow_dispatch' | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ inputs.version }} | |
name: Release v${{ inputs.version }} | |
#body: ${{ github.event.inputs.changelog }} | |
body: Auto-generated release version for build `${{ github.sha }}` | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
installer/bme_installer.exe |