name: Emu build (Windows) on: push: branches: [ "ci-build-emu-win*", "ci-build-all" ] tags: - release* pull_request: branches: [ "dev" ] workflow_dispatch: # allows manual trigger permissions: contents: write env: 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: build: runs-on: windows-2022 steps: - name: Checkout branch uses: actions/checkout@v4 ### deps - name: Lookup cache for deps id: emu-deps-cache-step # !tag && !pull_request # also you could use this: github.event_name != 'pull_request' if: | !startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/pull/') uses: actions/cache@v3 with: key: ${{ env.DEPS_CACHE_KEY }} path: ${{ env.DEPS_CACHE_DIR }} - name: Clone third-party deps (deps/win) if: steps.emu-deps-cache-step.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: ref: 'third-party/deps/win' path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win" - name: Clone third-party deps (deps/common) if: steps.emu-deps-cache-step.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: ref: 'third-party/deps/common' path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common" - name: Clone third-party deps (common/win) if: steps.emu-deps-cache-step.outputs.cache-hit != 'true' uses: actions/checkout@v4 with: ref: 'third-party/common/win' path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win" - name: Build deps if: steps.emu-deps-cache-step.outputs.cache-hit != 'true' shell: cmd working-directory: ${{ github.workspace }} run: build_win_deps.bat ## extra helpers/tools, these are not built inside the deps build dir - name: Clone third-party build helpers (common/win) uses: actions/checkout@v4 with: ref: 'third-party/common/win' path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win" - name: Clone third-party deps (deps/win) uses: actions/checkout@v4 with: ref: 'third-party/deps/win' path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win" ### build (release mode) - name: Build release mode shell: cmd working-directory: ${{ github.workspace }} run: build_win.bat release ### package (release mode) - name: Package build (release) shell: cmd working-directory: ${{ github.workspace }} run: package_win.bat release ### upload artifact/package to github Actions (release mode) - name: Upload build pacakge (release) 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 (debug mode) - name: Build debug mode shell: cmd working-directory: ${{ github.workspace }} run: build_win.bat debug ### package (debug mode) - name: Package build (debug) shell: cmd working-directory: ${{ github.workspace }} run: package_win.bat debug ### upload artifact/package to github Actions (debug mode) - name: Upload build pacakge (debug) 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 ### release (debug + release modes) if this is a tag push - name: Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: files: "${{ env.PACKAGE_ROOT_PATH }}/**/*"