318 lines
11 KiB
YAML
318 lines
11 KiB
YAML
# workflow name
|
|
name: Build
|
|
|
|
# fire on
|
|
on:
|
|
push:
|
|
branches:
|
|
- DoorDev
|
|
- DoorDevUnstable
|
|
pull_request:
|
|
branches:
|
|
- DoorDev
|
|
|
|
# stuff to do
|
|
jobs:
|
|
# Install & Build
|
|
# Set up environment
|
|
# Build
|
|
# Run build-gui.py
|
|
# Run build-dr.py
|
|
install-build:
|
|
name: Install/Build
|
|
# cycle through os list
|
|
runs-on: ${{ matrix.os-name }}
|
|
|
|
# VM settings
|
|
# os & python versions
|
|
strategy:
|
|
matrix:
|
|
os-name: [ ubuntu-latest, ubuntu-20.04, macOS-latest, windows-latest ]
|
|
python-version: [ 3.9 ]
|
|
# needs: [ install-test ]
|
|
steps:
|
|
# checkout commit
|
|
- name: Checkout commit
|
|
uses: actions/checkout@v3
|
|
# install python
|
|
- name: Install python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: "x64"
|
|
- run: |
|
|
python --version
|
|
# install dependencies via pip
|
|
- name: Install dependencies via pip
|
|
env:
|
|
OS_NAME: ${{ matrix.os-name }}
|
|
run: |
|
|
python ./resources/ci/common/install.py
|
|
pip install pyinstaller
|
|
# get parent directory
|
|
- name: Get Repo Name
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: repoName
|
|
with:
|
|
source: ${{ github.repository }}
|
|
find: '${{ github.repository_owner }}/'
|
|
replace: ''
|
|
- name: Get Parent Directory Path (!Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDirNotWin
|
|
with:
|
|
source: ${{ github.workspace }}
|
|
find: '${{ steps.repoName.outputs.value }}/${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
- name: Get Parent Directory Path (Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDir
|
|
with:
|
|
source: ${{ steps.parentDirNotWin.outputs.value }}
|
|
find: '${{ steps.repoName.outputs.value }}\${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
# try to get UPX
|
|
- name: Get UPX
|
|
env:
|
|
OS_NAME: ${{ matrix.os-name }}
|
|
run: |
|
|
python ./resources/ci/common/get_upx.py
|
|
# run build-gui.py
|
|
- name: Build GUI
|
|
run: |
|
|
python ./source/meta/build-gui.py
|
|
# run build-dr.py
|
|
- name: Build DungeonRandomizer
|
|
run: |
|
|
python ./source/meta/build-dr.py
|
|
# prepare binary artifacts for later step
|
|
- name: Prepare Binary Artifacts
|
|
env:
|
|
OS_NAME: ${{ matrix.os-name }}
|
|
run: |
|
|
python ./resources/ci/common/prepare_binary.py
|
|
# upload binary artifacts for later step
|
|
- name: Upload Binary Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binaries-${{ matrix.os-name }}
|
|
path: ${{ steps.parentDir.outputs.value }}/artifact
|
|
|
|
# Install & Preparing Release
|
|
# Set up environment
|
|
# Local Prepare Release action
|
|
install-prepare-release:
|
|
name: Install/Prepare Release
|
|
# cycle through os list
|
|
runs-on: ${{ matrix.os-name }}
|
|
|
|
# VM settings
|
|
# os & python versions
|
|
strategy:
|
|
matrix:
|
|
# install/release on not bionic
|
|
os-name: [ ubuntu-latest, ubuntu-20.04, macOS-latest, windows-latest ]
|
|
python-version: [ 3.9 ]
|
|
|
|
needs: [ install-build ]
|
|
steps:
|
|
# checkout commit
|
|
- name: Checkout commit
|
|
uses: actions/checkout@v3
|
|
# install python
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
architecture: "x64"
|
|
- run: |
|
|
python --version
|
|
# install dependencies via pip
|
|
- name: Install Dependencies via pip
|
|
env:
|
|
OS_NAME: ${{ matrix.os-name }}
|
|
run: |
|
|
python ./resources/ci/common/install.py
|
|
# get parent directory
|
|
- name: Get Repo Name
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: repoName
|
|
with:
|
|
source: ${{ github.repository }}
|
|
find: '${{ github.repository_owner }}/'
|
|
replace: ''
|
|
- name: Get Parent Directory Path (!Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDirNotWin
|
|
with:
|
|
source: ${{ github.workspace }}
|
|
find: '${{ steps.repoName.outputs.value }}/${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
- name: Get Parent Directory Path (Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDir
|
|
with:
|
|
source: ${{ steps.parentDirNotWin.outputs.value }}
|
|
find: '${{ steps.repoName.outputs.value }}\${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
# download binary artifact
|
|
- name: Download Binary Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: binaries-${{ matrix.os-name }}
|
|
path: ./
|
|
# Prepare AppVersion & Release
|
|
- name: Prepare AppVersion & Release
|
|
env:
|
|
OS_NAME: ${{ matrix.os-name }}
|
|
run: |
|
|
python ./build-app_version.py
|
|
python ./resources/ci/common/prepare_appversion.py
|
|
python ./resources/ci/common/prepare_release.py
|
|
# upload appversion artifact for later step
|
|
- name: Upload AppVersion Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: appversion-${{ matrix.os-name }}
|
|
path: ./resources/app/meta/manifests/app_version.txt
|
|
# upload archive artifact for later step
|
|
- name: Upload Archive Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: archive-${{ matrix.os-name }}
|
|
path: ${{ steps.parentDir.outputs.value }}/deploy
|
|
|
|
# Deploy to GitHub Releases
|
|
# Release Name: ALttPDoorRandomizer v${GITHUB_TAG}
|
|
# Release Body: Inline content of RELEASENOTES.md
|
|
# Release Body: Fallback to URL to RELEASENOTES.md
|
|
# Release Files: ${{ steps.parentDir.outputs.value }}/deploy
|
|
deploy-release:
|
|
name: Deploy GHReleases
|
|
runs-on: ${{ matrix.os-name }}
|
|
|
|
# VM settings
|
|
# os & python versions
|
|
strategy:
|
|
matrix:
|
|
# release only on focal
|
|
os-name: [ ubuntu-latest ]
|
|
python-version: [ 3.9 ]
|
|
|
|
needs: [ install-prepare-release ]
|
|
steps:
|
|
# checkout commit
|
|
- name: Checkout commit
|
|
uses: actions/checkout@v3
|
|
# get parent directory
|
|
- name: Get Repo Name
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: repoName
|
|
with:
|
|
source: ${{ github.repository }}
|
|
find: '${{ github.repository_owner }}/'
|
|
replace: ''
|
|
- name: Get Parent Directory Path (!Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDirNotWin
|
|
with:
|
|
source: ${{ github.workspace }}
|
|
find: '${{ steps.repoName.outputs.value }}/${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
- name: Get Parent Directory Path (Windows)
|
|
uses: mad9000/actions-find-and-replace-string@3
|
|
id: parentDir
|
|
with:
|
|
source: ${{ steps.parentDirNotWin.outputs.value }}
|
|
find: '${{ steps.repoName.outputs.value }}\${{ steps.repoName.outputs.value }}'
|
|
replace: ${{ steps.repoName.outputs.value }}
|
|
- name: Install Dependencies via pip
|
|
run: |
|
|
python -m pip install pytz requests
|
|
# download appversion artifact
|
|
- name: Download AppVersion Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: appversion-${{ matrix.os-name }}
|
|
path: ${{ steps.parentDir.outputs.value }}/build
|
|
# download ubuntu archive artifact
|
|
- name: Download Ubuntu Archive Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: archive-ubuntu-latest
|
|
path: ${{ steps.parentDir.outputs.value }}/deploy/linux
|
|
# download macos archive artifact
|
|
- name: Download MacOS Archive Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: archive-macOS-latest
|
|
path: ${{ steps.parentDir.outputs.value }}/deploy/macos
|
|
# download windows archive artifact
|
|
- name: Download Windows Archive Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: archive-windows-latest
|
|
path: ${{ steps.parentDir.outputs.value }}/deploy/windows
|
|
# debug info
|
|
- name: Debug Info
|
|
id: debug_info
|
|
# shell: bash
|
|
# git tag ${GITHUB_TAG}
|
|
# git push origin ${GITHUB_TAG}
|
|
run: |
|
|
GITHUB_TAG="$(head -n 1 ../build/app_version.txt)"
|
|
echo "::set-output name=github_tag::$GITHUB_TAG"
|
|
GITHUB_TAG="v${GITHUB_TAG}"
|
|
RELEASE_NAME="ALttPDoorRandomizer ${GITHUB_TAG}"
|
|
echo "Release Name: ${RELEASE_NAME}"
|
|
echo "Git Tag: ${GITHUB_TAG}"
|
|
# create a pre/release
|
|
- name: Create a Pre/Release
|
|
id: create_release
|
|
uses: actions/create-release@v1.1.4
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: v${{ steps.debug_info.outputs.github_tag }}
|
|
release_name: ALttPDoorRandomizer v${{ steps.debug_info.outputs.github_tag }}
|
|
body_path: RELEASENOTES.md
|
|
draft: true
|
|
prerelease: true
|
|
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
|
|
# upload linux archive asset
|
|
- name: Upload Linux Archive Asset
|
|
id: upload-linux-asset
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ../deploy/linux/ALttPDoorRandomizer.tar.gz
|
|
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-linux-focal.tar.gz
|
|
asset_content_type: application/gzip
|
|
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
|
|
# upload macos archive asset
|
|
- name: Upload MacOS Archive Asset
|
|
id: upload-macos-asset
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ../deploy/macos/ALttPDoorRandomizer.tar.gz
|
|
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-osx.tar.gz
|
|
asset_content_type: application/gzip
|
|
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
|
|
# upload windows archive asset
|
|
- name: Upload Windows Archive Asset
|
|
id: upload-windows-asset
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ../deploy/windows/ALttPDoorRandomizer.zip
|
|
asset_name: ALttPDoorRandomizer-${{ steps.debug_info.outputs.github_tag }}-windows.zip
|
|
asset_content_type: application/zip
|
|
if: contains(github.ref, 'master') || contains(github.ref, 'stable') || contains(github.ref, 'dev') || contains(github.ref, 'DoorRelease')
|