xenia-canary/.github/workflows/CI.yml

116 lines
3.7 KiB
YAML
Raw Normal View History

2021-01-31 10:10:55 +00:00
name: CI
on:
push:
2022-03-07 22:53:58 +00:00
branches-ignore: [gh-pages, master]
2021-01-31 10:10:55 +00:00
paths-ignore:
2022-03-07 22:53:58 +00:00
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
2021-01-31 10:10:55 +00:00
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- 'docs/**'
2022-03-07 22:53:58 +00:00
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
2021-01-31 10:10:55 +00:00
- 'LICENSE'
2022-03-07 22:53:58 +00:00
- 'README.md'
2021-01-31 10:10:55 +00:00
pull_request:
2022-03-07 22:53:58 +00:00
branches-ignore: [gh-pages, master]
2021-01-31 10:10:55 +00:00
paths-ignore:
2022-03-07 22:53:58 +00:00
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
2021-01-31 10:10:55 +00:00
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- 'docs/**'
2022-03-07 22:53:58 +00:00
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
2021-01-31 10:10:55 +00:00
- 'LICENSE'
2022-03-07 22:53:58 +00:00
- 'README.md'
2021-01-31 10:10:55 +00:00
workflow_dispatch:
jobs:
build-windows:
2022-02-17 02:37:15 +00:00
runs-on: ${{ matrix.runs-on }}
2021-01-31 10:10:55 +00:00
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
strategy:
fail-fast: false
2022-02-17 02:37:15 +00:00
matrix:
runs-on: [windows-2019, windows-latest]
include:
- runs-on: windows-2019
vsver: VS2019
- runs-on: windows-latest
vsver: VS2022
2021-01-31 10:10:55 +00:00
steps:
2022-03-07 22:53:58 +00:00
- uses: actions/checkout@v3
2022-02-17 02:37:15 +00:00
with:
fetch-depth: 0
- name: Setup
run: .\xb setup
- name: Build
run: .\xb build --config=Release --target=src\xenia-app --target=src\xenia-vfs-dump
- name: Prepare artifacts
run: |
robocopy . build\bin\${{ runner.os }}\Release LICENSE /r:0 /w:0
robocopy build\bin\${{ runner.os }}\Release artifacts\xenia_canary xenia_canary.exe xenia_canary.pdb LICENSE /r:0 /w:0
robocopy build\bin\${{ runner.os }}\Release artifacts\xenia-vfs-dump xenia-vfs-dump.exe xenia-vfs-dump.pdb LICENSE /r:0 /w:0
curl -fLJO https://github.com/xenia-canary/game-patches/archive/refs/heads/main.zip
7z e game-patches-main.zip game-patches-main\patches -oartifacts\xenia_canary\patches
2022-02-17 02:37:15 +00:00
- name: Upload xenia-vfs-dump artifacts
2022-03-09 20:49:37 +00:00
uses: actions/upload-artifact@v3
2022-02-17 02:37:15 +00:00
with:
2022-02-19 21:03:35 +00:00
name: xenia-vfs-dump_canary_${{ matrix.vsver }}
2022-02-17 02:37:15 +00:00
path: artifacts\xenia-vfs-dump
if-no-files-found: error
- name: Upload xenia artifacts
2022-03-09 20:49:37 +00:00
uses: actions/upload-artifact@v3
2022-02-17 02:37:15 +00:00
with:
name: xenia_canary_${{ matrix.vsver }}
path: artifacts\xenia_canary
if-no-files-found: error
- name: Create release
if: |
matrix.runs-on == 'windows-2019' &&
github.repository == 'xenia-canary/xenia-canary' &&
github.event.action != 'pull_request' &&
contains(github.ref, 'refs/heads/canary') &&
github.ref != 'refs/heads/canary_base'
2022-02-17 02:37:15 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$asset="xenia_canary.zip"
7z a $asset .\artifacts\xenia_canary\*.exe LICENSE
If ($(Get-Item $asset).length -le 100000) {
Throw "Error: Archive $asset too small!"
}
$tag=$env:GITHUB_SHA.SubString(0,7)
$branch=$($env:GITHUB_REF -replace 'refs/heads/', '')
$title="${tag}_$branch"
2022-02-17 02:37:15 +00:00
gh release create $tag $asset --target $env:GITHUB_SHA -t $title
2022-02-28 14:54:53 +00:00
# Remove canary_ to prevent conflicts from tag
$tag=$($branch -replace 'canary_', '')
gh release delete $tag -y
2022-03-05 08:52:16 +00:00
git push --delete origin $tag
git tag -d $tag
2022-02-28 14:54:53 +00:00
gh release create $tag $asset --target $env:GITHUB_SHA -t $branch