mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-29 11:54:15 +08:00
90b403fb3d
+ add steps: package + release to add packaged build to release when pushing on tag + support building on prefixed branch name with wildcard + support event trigger on tag + support event trigger on workflow dispatch for manual trigger
163 lines
4.3 KiB
YAML
163 lines
4.3 KiB
YAML
name: Emu build (Windows)
|
|
|
|
on:
|
|
push:
|
|
branches: [
|
|
"ci-build-emu-win*",
|
|
"ci-build-all"
|
|
]
|
|
tags:
|
|
- release*
|
|
pull_request:
|
|
branches: [ "dev" ]
|
|
workflow_dispatch:
|
|
# nothing
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
# Expected format {owner}/{repo}.
|
|
DEPS_REPO: 'otavepto/gbe_fork'
|
|
THIRD_PARTY_BASE_DIR: 'third-party'
|
|
DEPS_CACHE_KEY: emu-deps-win
|
|
DEPS_CACHE_DIR: build-win-deps
|
|
|
|
PACKAGE_ROOT_PATH: "build-win/package"
|
|
|
|
jobs:
|
|
dependencies:
|
|
runs-on: windows-2022
|
|
|
|
steps:
|
|
- name: Lookup cache for deps
|
|
id: emu-deps-cache-step
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: ${{ env.DEPS_CACHE_KEY }}
|
|
path: ${{ env.DEPS_CACHE_DIR }}
|
|
lookup-only: true
|
|
|
|
# we need the repo to build the deps since it has the build scripts
|
|
- name: Checkout branch
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Clone third-party deps (deps/win)
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "${{env.DEPS_REPO}}"
|
|
ref: 'third-party/deps/win'
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
|
|
lfs: true
|
|
|
|
- name: Clone third-party deps (deps/common)
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "${{env.DEPS_REPO}}"
|
|
ref: 'third-party/deps/common'
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
|
|
lfs: true
|
|
|
|
- name: Clone third-party deps (common/win)
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "${{env.DEPS_REPO}}"
|
|
ref: 'third-party/common/win'
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
|
|
lfs: true
|
|
|
|
- name: Build deps
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
shell: cmd
|
|
working-directory: ${{ github.workspace }}
|
|
run: build_win_deps.bat
|
|
|
|
|
|
build:
|
|
needs: [ dependencies ]
|
|
runs-on: windows-2022
|
|
|
|
steps:
|
|
- name: Checkout branch
|
|
uses: actions/checkout@v4
|
|
|
|
### deps
|
|
- name: Grab cache for deps
|
|
id: emu-deps-cache-step
|
|
uses: actions/cache@v3
|
|
with:
|
|
key: ${{ env.DEPS_CACHE_KEY }}
|
|
path: ${{ env.DEPS_CACHE_DIR }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Clone third-party build helpers (common/win)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "${{env.DEPS_REPO}}"
|
|
ref: 'third-party/common/win'
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
|
|
lfs: true
|
|
|
|
- name: Clone third-party deps (deps/win)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: "${{env.DEPS_REPO}}"
|
|
ref: 'third-party/deps/win'
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
|
|
|
|
### build + upload release
|
|
- name: Build release mode
|
|
continue-on-error: true
|
|
shell: cmd
|
|
working-directory: ${{ github.workspace }}
|
|
run: build_win.bat release
|
|
|
|
- name: Package build (release)
|
|
if: success()
|
|
shell: cmd
|
|
working-directory: ${{ github.workspace }}
|
|
run: package_win.bat release
|
|
|
|
- name: Upload build pacakge (release)
|
|
if: success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: "build-win-release-${{ github.sha }}"
|
|
path: "${{ env.PACKAGE_ROOT_PATH }}/release/"
|
|
if-no-files-found: 'error'
|
|
compression-level: 9
|
|
retention-days: 1
|
|
|
|
### build + upload debug
|
|
- name: Build debug mode
|
|
continue-on-error: true
|
|
shell: cmd
|
|
working-directory: ${{ github.workspace }}
|
|
run: build_win.bat debug
|
|
|
|
- name: Package build (debug)
|
|
if: success()
|
|
shell: cmd
|
|
working-directory: ${{ github.workspace }}
|
|
run: package_win.bat debug
|
|
|
|
- name: Upload build pacakge (debug)
|
|
if: success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: "build-win-debug-${{ github.sha }}"
|
|
path: "${{ env.PACKAGE_ROOT_PATH }}/debug/"
|
|
if-no-files-found: 'error'
|
|
compression-level: 9
|
|
retention-days: 1
|
|
|
|
- name: Release
|
|
if: success() && startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: "${{ env.PACKAGE_ROOT_PATH }}/**/*"
|
|
|