-
-
Notifications
You must be signed in to change notification settings - Fork 9
123 lines (111 loc) · 4.24 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ----------------------------------------------------------------------------
# GitHub Actions workflow to build and package the project using Castle Game Engine.
# ----------------------------------------------------------------------------
name: Build
on:
push:
pull_request:
repository_dispatch:
types: [cge-docker-unstable-changed]
defaults:
run:
shell: bash
env:
# To which GitHub release tag should we upload artifacts.
# Can be "snapshot" or "vX.Y.Z" (latter when we make stable release).
release_tag: snapshot
#release_tag: vX.Y.Z
jobs:
build_docker:
name: Build From Docker
runs-on: ubuntu-latest
container: kambi/castle-engine-cloud-builds-tools:cge-none
steps:
- uses: actions/checkout@v4
# Setup Castle Game Engine
- name: Castle Game Engine - Env CASTLE_ENGINE_PATH
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Env BUILD_TOOL
run: echo "BUILD_TOOL=$CASTLE_ENGINE_PATH/tools/build-tool/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Clone snapshot
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/
- name: Castle Game Engine - Build
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh
# Package application
- name: Package Windows / x86_64
run: ${BUILD_TOOL} package --os=win64 --cpu=x86_64
- name: Package Windows / i386
run: ${BUILD_TOOL} package --os=win32 --cpu=i386
- name: Package Linux / x86_64
run: ${BUILD_TOOL} package --os=linux --cpu=x86_64
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-linux-builds
path: |
*.zip
*.tar.gz
#if-no-files-found: error
build_runner_native:
name: Build on Native Runner (target OS/CPU = source OS/CPU)
strategy:
matrix:
runner: [macos_x64, raspberry_pi_64, raspberry_pi_32]
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
# Setup Castle Game Engine
- name: Castle Game Engine - Env CASTLE_ENGINE_PATH
run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Env BUILD_TOOL
run: echo "BUILD_TOOL=$CASTLE_ENGINE_PATH/tools/build-tool/castle-engine" >> $GITHUB_ENV
- name: Castle Game Engine - Clone snapshot
run: git clone --depth 1 --single-branch --branch snapshot https://github.com/castle-engine/castle-engine/
- name: Castle Game Engine - Build
run: cd $CASTLE_ENGINE_PATH/tools/build-tool/ && ./castle-engine_compile.sh
# Package application
- name: Package
run: ${BUILD_TOOL} package
- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runner }}-build
path: |
*.zip
*.tar.gz
#if-no-files-found: error
release:
name: Release
runs-on: ubuntu-latest
# Only upload release if all builds, on all runners, succeeded.
needs: [build_docker, build_runner_native]
steps:
- name: Download packaged releases
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: List downloaded files
run: ls -R
- name: GH CLI status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh auth status
# Releases files in the GitHub release.
- name: Release Artifacts
if: ${{ github.ref == 'refs/heads/master' }}
run: gh release --repo ${{ github.repository }} upload ${{ env.release_tag }} --clobber *.zip *.tar.gz
env:
GH_TOKEN: ${{ github.token }}
update-release-tag:
name: Update Release Tag (make release tag point to the build commit on master branch)
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v4
- name: Update Release Tag
if: ${{ github.ref == 'refs/heads/master' }}
run: |
# --force allows to overwrite previous tag
git tag --force ${{ env.release_tag }}
# --force allows to push with overwritten tag
git push --force origin ${{ env.release_tag }}