Skip to content

Commit

Permalink
fix build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bradstv committed Jun 11, 2024
1 parent c5264f4 commit 2f67c62
Showing 1 changed file with 53 additions and 44 deletions.
97 changes: 53 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ concurrency:

jobs:
build:
name: Build binaries
name: Build
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
configuration:
- Debug
#- Debug
- Release
steps:
steps:
- name: Check out files
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.2
with:
submodules: true
fetch-depth: 0
Expand All @@ -35,74 +36,82 @@ jobs:
uses: microsoft/setup-msbuild@v1.3.1

- name: Generate project files
#run: tools/premake5 vs2022 --ci-build
run: tools/premake5 vs2022
run: tools/premake5 vs2022 --no-check

- name: Set up problem matching
uses: ammaraskar/msvc-problem-matcher@master

- name: Build ${{matrix.configuration}} binaries
- name: Build ${{matrix.configuration}}
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/iw6x.sln

- name: Upload ${{matrix.configuration}} binaries
- 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}} binaries
name: ${{matrix.configuration}} Binary
path: |
build/bin/x64/${{matrix.configuration}}/iw6x.exe
build/bin/x64/${{matrix.configuration}}/iw6x.pdb
- 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: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
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: Setup main environment
if: github.ref == 'refs/heads/master'
run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH }}" >> $GITHUB_ENV

- name: Setup develop environment
if: github.ref == 'refs/heads/develop'
run: echo "XLABS_MASTER_PATH=${{ secrets.XLABS_MASTER_SSH_PATH_DEV }}" >> $GITHUB_ENV

- name: Download Release binaries
uses: actions/download-artifact@v3.0.2
with:
name: Release binaries
name: Release Binary

- name: Download Release data artifacts
uses: actions/download-artifact@v3.0.2
with:
name: Release data artifacts
path: data

# Set up committer info and GPG key
- name: Install SSH key
uses: shimataro/ssh-key-action@v2.5.0
with:
key: ${{ secrets.XLABS_MASTER_SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'

- name: Add known hosts
run: ssh-keyscan -H ${{ secrets.XLABS_MASTER_SSH_ADDRESS }} >> ~/.ssh/known_hosts

- name: Remove old data files
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} rm -rf ${{ env.XLABS_MASTER_PATH }}/iw6x/data/*

- name: Upload iw6x binary
run: rsync -avz iw6x.exe ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw6x/

- name: Upload data files
run: rsync -avz ./data/ ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw6x/data/

- name: Publish changes
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
- 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

0 comments on commit 2f67c62

Please sign in to comment.