t7x/.github/workflows/build.yml

126 lines
4.0 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
2022-06-16 03:55:21 -04:00
- name: Upload ${{matrix.configuration}} bundle
2023-02-08 19:54:45 -05:00
uses: actions/upload-artifact@v3.1.2
2022-05-21 14:16:20 -04:00
with:
2022-06-16 03:55:21 -04:00
name: ${{matrix.configuration}} Bundle
2022-05-21 14:16:20 -04:00
path: |
2022-11-09 12:14:17 -05:00
build/bin/x64/${{matrix.configuration}}/boiii.exe
build/bin/x64/${{matrix.configuration}}/boiii.pdb
2022-06-16 03:55:21 -04:00
- name: Upload ${{matrix.configuration}} binary
if: matrix.configuration == 'Release'
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
uses: actions/upload-artifact@v3.1.2
with:
name: ${{matrix.configuration}} data artifacts
path: |
data/*
2022-06-16 04:07:06 -04:00
- name: Upload version
if: matrix.configuration == 'Release'
2023-02-08 19:54:45 -05:00
uses: actions/upload-artifact@v3.1.2
2022-06-16 04:07:06 -04:00
with:
name: Version
path: |
build/version.txt
2023-02-18 10:16:44 -05:00
deploy:
name: Deploy artifacts
needs: build
runs-on: ubuntu-latest
2023-02-18 10:23:17 -05:00
if: 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-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 }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- 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 }}