Skip to content

Commit

Permalink
GitHub workflow from RSS, minimally adapted
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Jun 3, 2024
1 parent 55a940d commit 2a7ed4a
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 2 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
check-secret:
runs-on: ubuntu-latest
outputs:
has-password: ${{ steps.has-password.outputs.defined }}
steps:
- id: has-password
if: "${{ env.KSP_ZIP_PASSWORD != '' }}"
run: echo "::set-output name=defined::true"
env:
KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }}
validate-cfg-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Validate config files
uses: KSP-CKAN/KSPMMCfgParser@master
build:
runs-on: ubuntu-latest
needs: [check-secret]
if: needs.check-secret.outputs.has-password == 'true'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Download required assemblies
id: download-assemblies
shell: bash
env:
KSP_ZIP_PASSWORD: ${{ secrets.KSP_ZIP_PASSWORD }}
run: |
curl https://ksp-ro.s3-us-west-2.amazonaws.com/KSPAssemblies-1.12.zip --output /tmp/bins.zip
KSP_DLL_PATH="/opt/ksp/assembly"
echo "::set-output name=ksp-dll-path::${KSP_DLL_PATH}"
mkdir -p "${KSP_DLL_PATH}"
unzip -P "${KSP_ZIP_PASSWORD}" '/tmp/bins.zip' -d "${KSP_DLL_PATH}"
rm '/tmp/bins.zip'
- name: Build mod solution
run: |
rm -f ${GITHUB_WORKSPACE}/GameData/RealAntennas/Plugins/*.dll
msbuild /p:Configuration=Release /p:ReferencePath="${{ steps.download-assemblies.outputs.ksp-dll-path }}" ${GITHUB_WORKSPACE}/src/RealAntennasProject.sln
#- name: Remove excess DLLs
# uses: KSP-RO/BuildTools/remove-excess-dlls@master
# with:
# path: ${GITHUB_WORKSPACE}/GameData/

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.0

- name: Build metadata
shell: bash
run: |
python ${GITHUB_WORKSPACE}/makeMeta.py 2.0.0.0
- name: Assemble release
id: assemble-release
run: |
RELEASE_DIR="${RUNNER_TEMP}/release"
echo "Release dir: ${RELEASE_DIR}"
mkdir -v "${RELEASE_DIR}"
echo "::set-output name=release-dir::${RELEASE_DIR}"
cp -v -R "${GITHUB_WORKSPACE}/GameData" "${RELEASE_DIR}"
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: RealAntennas
path: ${{ steps.assemble-release.outputs.release-dir }}
9 changes: 7 additions & 2 deletions src/RealAntennasProject.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.352
# Visual Studio Version 17
VisualStudioVersion = 17.7.34018.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealAntennas", "RealAntennasProject\RealAntennas.csproj", "{F3C57338-2B69-47CB-A9FF-7EEF1D109490}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub workflows", "GitHub workflows", "{6EB015BB-8C8E-4C5E-AB48-AA22A076DAA1}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down

0 comments on commit 2a7ed4a

Please sign in to comment.