smol fix #40
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: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
types: [opened, synchronize, reopened] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: | |
#- Debug | |
- Release | |
steps: | |
- name: Set Git to use LF line endings | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Check out files | |
uses: actions/checkout@v3.5.2 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
# NOTE - If LFS ever starts getting used during builds, switch this to true! | |
lfs: false | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v1.3.1 | |
- name: Generate project files | |
run: tools/premake5 vs2022 | |
- name: Set up problem matching | |
uses: ammaraskar/msvc-problem-matcher@master | |
- name: Build ${{matrix.configuration}} | |
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/iw6x.sln | |
- name: Upload ${{matrix.configuration}} binary | |
if: matrix.configuration == 'Release' && github.repository_owner == 'CBServers' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: ${{matrix.configuration}} Binary | |
path: | | |
build/bin/x64/${{matrix.configuration}}/iw6x.exe | |
- name: Upload ${{matrix.configuration}} data artifacts | |
if: matrix.configuration == 'Release' && github.repository_owner == 'CBServers' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: ${{matrix.configuration}} data artifacts | |
path: | | |
data/* | |
deploy: | |
name: Deploy artifacts | |
needs: build | |
runs-on: windows-2022 | |
if: github.repository_owner == 'CBServers' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
steps: | |
- name: Download Release binaries | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: Release Binary | |
- name: Download Release data artifacts | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: Release data artifacts | |
path: data | |
- name: Download hashing executable | |
run: | | |
Invoke-WebRequest -Uri "https://github.com/CBServers/updater/releases/download/v1.0.0/update-hasher.exe" -OutFile "update-hasher.exe" | |
- name: Generate hashed.json | |
run: | | |
.\update-hasher.exe | |
- name: Move files to iw6x folder and rename hashes | |
run: | | |
mkdir iw6x | |
Move-Item -Path .\iw6x.exe -Destination .\iw6x\ | |
Move-Item -Path .\data -Destination .\iw6x\ | |
mv hashed.json iw6x.json | |
- name: Clone updater | |
run: | | |
git config --global user.name 'CBServers' | |
git config --global user.email '${{ secrets.OWNER_EMAIL }}' | |
$env:GIT_TERMINAL_PROMPT=0 | |
$env:GIT_USERNAME="CBServers" | |
$env:GIT_PASSWORD="${{ secrets.REPO_PAT }}" | |
git clone https://$env:GIT_USERNAME:$env:GIT_PASSWORD@github.com/CBServers/updater.git | |
- name: Copy files to updater and cleanup | |
run: | | |
Copy-Item -Path .\iw6x.json -Destination .\updater\updater\ -Force | |
Copy-Item -Path .\iw6x\* -Destination .\updater\updater\iw6x\ -Recurse -Force | |
Remove-Item -Path .\iw6x.json -Force | |
Remove-Item -Path .\iw6x -Recurse -Force | |
Remove-Item -Path .\update-hasher.exe -Force | |
- name: Push changes to updater | |
run: | | |
cd updater | |
git add . | |
git commit -m "Update artifacts" | |
git push origin main |