You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KSP-DepthMask/.github/workflows/ksp-publish.yml

132 lines
3.6 KiB
YAML

name: Build and Release
on:
push:
pull_request:
types:
- opened
- edited
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install Python Tools
run: |
python -m pip install --upgrade pip
python -m pip install -r Tools/requirements.txt
- name: Download Dependencies
run: |
mkdir -p DepthMask/dlls
mkdir -p GameData
mkdir -p GameData/DepthMask
wget --user drewcassidy --password ${{ secrets.PILE_OF_ROCKS_PASS }} https://pileof.rocks/Secret/KSP-1.12.3-dlls.zip
unzip KSP-*-dlls.zip -d DepthMask/
- name: Generate Version Info
run: |
python Tools/version.py
- name: Validate Version Info
uses: DasSkelett/AVC-VersionFileValidator@master
with:
only: '["./GameData/DepthMask/DepthMask.version"]'
- name: Build DLL
run: |
dotnet build --configuration Release DepthMask.sln
- name: Upload Build
uses: actions/upload-artifact@v3
with:
name: DepthMask
path: |
GameData/DepthMask
README.md
CHANGELOG.md
LICENSE.md
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python Tools
run: |
python -m pip install --upgrade pip
python -m pip install yaclog
- name: Setup SSH keys
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.PILE_OF_ROCKS_PRIVATE_KEY }}
ssh-host: pileof.rocks
- name: Get version name and body
run: |
echo "VERSION_TITLE=$(yaclog show -n)" >> $GITHUB_ENV
echo "$(yaclog show -mb)" >> RELEASE.md
- name: Download Build Artifacts
uses: actions/download-artifact@v3
- name: Zip Download Packages
run: |
mkdir deploy
zip -r deploy/DepthMask-$VERSION_TITLE.zip DepthMask/*
cp DepthMask/GameData/DepthMask/DepthMask.version deploy/
ls deploy
- name: Publish to Github
uses: softprops/action-gh-release@v1
with:
files: |
deploy/DepthMask-*.zip
deploy/DepthMask.version
name: DepthMask Version ${{ env.VERSION_TITLE }}
body_path: RELEASE.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Spacedock
run: |
curl -F "username=drewcassidy" -F "password=${{ secrets.SPACEDOCK_PASS }}" \
-c ./cookies "https://spacedock.info/api/login"
curl -c ./cookies -b ./cookies \
-F "version=$VERSION_TITLE" \
-F "changelog=$(yaclog show -mb)" \
-F "game-version=1.12.4" \
-F "notify-followers=yes" \
-F "zipball=@deploy/DepthMask-$VERSION_TITLE.zip" \
"https://spacedock.info/api/mod/2943/update"
- name: Publish to Server
run: |
rsync -t deploy/* drewcassidy@pileof.rocks:/var/www/pileof.rocks/html/KSP/