t7x/.github/workflows/build.yml

129 lines
4.5 KiB
YAML
Raw Normal View History

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