t7x/.github/workflows/build.yml

130 lines
4.5 KiB
YAML
Raw Normal View History

2022-05-21 20:16:20 +02:00
name: Build
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
types: [opened, synchronize, reopened]
2022-11-25 15:40:04 +00:00
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
2022-05-21 20:16:20 +02:00
jobs:
build:
2022-06-16 09:55:21 +02:00
name: Build
2022-05-21 20:16:20 +02:00
runs-on: windows-2022
strategy:
2022-10-18 08:02:41 +02:00
fail-fast: false
2022-05-21 20:16:20 +02:00
matrix:
configuration:
- Debug
- Release
steps:
- name: Check out files
2023-02-09 00:54:45 +00:00
uses: actions/checkout@v3.3.0
2022-05-21 20:16:20 +02:00
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
2023-02-09 00:54:45 +00:00
uses: microsoft/setup-msbuild@v1.3.1
2022-05-21 20:16:20 +02:00
- name: Generate project files
2023-02-26 13:02:05 +01:00
run: tools/premake5 vs2022 --no-check
2022-05-21 20:16:20 +02:00
- name: Set up problem matching
uses: ammaraskar/msvc-problem-matcher@master
2022-06-16 09:55:21 +02:00
- name: Build ${{matrix.configuration}}
2022-05-29 16:02:50 +02:00
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/boiii.sln
2022-05-21 20:16:20 +02:00
2023-04-02 08:29:23 +02:00
- name: Upload ${{matrix.configuration}} symbols
if: matrix.configuration == 'Release' && github.repository_owner == 'momo5502' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
2023-02-09 00:54:45 +00:00
uses: actions/upload-artifact@v3.1.2
2022-05-21 20:16:20 +02:00
with:
2023-04-02 08:29:23 +02:00
name: ${{matrix.configuration}} Symbols
2022-05-21 20:16:20 +02:00
path: |
2022-11-09 18:14:17 +01:00
build/bin/x64/${{matrix.configuration}}/boiii.pdb
2022-06-16 09:55:21 +02:00
- name: Upload ${{matrix.configuration}} binary
2023-04-02 08:29:23 +02:00
if: matrix.configuration == 'Release' && github.repository_owner == 'momo5502' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
2023-02-09 00:54:45 +00:00
uses: actions/upload-artifact@v3.1.2
2022-06-16 09:55:21 +02:00
with:
name: ${{matrix.configuration}} Binary
path: |
2022-11-09 18:14:17 +01:00
build/bin/x64/${{matrix.configuration}}/boiii.exe
2022-06-16 10:07:06 +02:00
2023-02-18 16:16:44 +01:00
- name: Upload ${{matrix.configuration}} data artifacts
2023-04-02 08:29:23 +02:00
if: matrix.configuration == 'Release' && github.repository_owner == 'momo5502' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
2023-02-18 16:16:44 +01:00
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
2023-03-06 18:49:28 +01:00
if: github.repository_owner == 'momo5502' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
2023-02-18 16:16:44 +01:00
steps:
2023-02-18 16:44:30 +01:00
- name: Setup environment
run: echo "BOIII_MASTER_PATH=${{ secrets.BOIII_MASTER_SSH_PATH }}" >> $GITHUB_ENV
2023-02-18 16:16:44 +01:00
#- name: Setup main environment
2023-02-18 16:23:17 +01:00
# if: github.ref == 'refs/heads/main'
2023-02-18 16:16:44 +01:00
# run: echo "BOIII_MASTER_PATH=${{ secrets.BOIII_MASTER_SSH_PATH }}" >> $GITHUB_ENV
#- name: Setup develop environment
# if: github.ref == 'refs/heads/develop'
# run: echo "BOIII_MASTER_PATH=${{ secrets.BOIII_MASTER_SSH_PATH_DEV }}" >> $GITHUB_ENV
- name: Download Release binaries
2023-02-21 18:00:59 +01:00
uses: actions/download-artifact@v3.0.2
2023-02-18 16:16:44 +01:00
with:
2023-02-18 16:31:18 +01:00
name: Release Binary
2023-03-06 18:49:28 +01:00
2023-02-18 16:16:44 +01:00
- name: Download Release data artifacts
2023-02-21 18:00:59 +01:00
uses: actions/download-artifact@v3.0.2
2023-02-18 16:16:44 +01:00
with:
name: Release data artifacts
path: data
- name: Install SSH key
2023-02-21 18:00:59 +01:00
uses: shimataro/ssh-key-action@v2.5.0
2023-02-18 16:16:44 +01:00
with:
key: ${{ secrets.BOIII_MASTER_SSH_PRIVATE_KEY }}
2023-03-06 18:49:28 +01:00
known_hosts: "just-a-placeholder-so-we-dont-get-errors"
2023-02-18 16:16:44 +01:00
- name: Add known hosts
run: ssh-keyscan -H ${{ secrets.BOIII_MASTER_SSH_ADDRESS }} >> ~/.ssh/known_hosts
- name: Remove old data files
run: ssh ${{ secrets.BOIII_MASTER_SSH_USER }}@${{ secrets.BOIII_MASTER_SSH_ADDRESS }} rm -rf ${{ env.BOIII_MASTER_PATH }}/boiii/data/*
- name: Upload BOIII binary
run: rsync -avz boiii.exe ${{ secrets.BOIII_MASTER_SSH_USER }}@${{ secrets.BOIII_MASTER_SSH_ADDRESS }}:${{ env.BOIII_MASTER_PATH }}/boiii/
- name: Upload data files
run: rsync -avz ./data/ ${{ secrets.BOIII_MASTER_SSH_USER }}@${{ secrets.BOIII_MASTER_SSH_ADDRESS }}:${{ env.BOIII_MASTER_PATH }}/boiii/data/
- name: Publish changes
run: ssh ${{ secrets.BOIII_MASTER_SSH_USER }}@${{ secrets.BOIII_MASTER_SSH_ADDRESS }} ${{ secrets.BOIII_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
2023-04-02 08:29:23 +02:00
- name: Prepare cleanup
2023-04-02 08:37:29 +02:00
run: echo "" > boiii.exe
2023-04-02 08:29:23 +02:00
- name: Cleanup
uses: actions/upload-artifact@v3.1.2
with:
name: Release Binary
2023-04-02 08:46:08 +02:00
retention-days: 1
2023-04-02 08:29:23 +02:00
path: |
2023-04-02 08:37:29 +02:00
boiii.exe