-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (128 loc) · 5.42 KB
/
Copy pathbuild.yml
File metadata and controls
137 lines (128 loc) · 5.42 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# ----------------------------------------------------------------------------
# GitHub Actions workflow to build this application.
# Using latest Castle Game Engine ( https://castle-engine.io/ ) snapshot.
# For multiple platforms (Linux, Windows, macOS, Android).
#
# This uses GitHub-hosted runners, that is: you don't need to set up any server
# infrastructure, GitHub provides it all for free for open-source projects.
#
# See docs:
# - https://castle-engine.io/github_actions
# - https://docs.github.com/en/actions
# ----------------------------------------------------------------------------
name: Build
on:
workflow_dispatch:
pull_request:
push:
branches: [master]
jobs:
# Build for platforms supported by
# CGE Docker image https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ .
#
# Since setting up Docker image takes majority of time (5-6 mins)
# compared to actually getting and compiling CGE (1 min)
# and building application (~1 min for each platform),
# we build all platforms possible within one job.
build-using-docker:
name: Build Using Docker
runs-on: ubuntu-latest
container: kambi/castle-engine-cloud-builds-tools:cge-unstable
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive' # fetch submodules listed in .gitmodules
fetch-depth: 0 # fetch full history (required for some submodule setups)
- name: generate salt include file from secret
run: |
printf "Salt = '%s';" "${{ secrets.SALT }}" > code/salt.inc
# We use "cge-unstable" Docker image, that already contains
# Castle Game Engine sources and build tools.
#
# If you would like to setup CGE by a GIT checkout instead, here's how:
# Set env CASTLE_ENGINE_PATH following
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
# https://brandur.org/fragments/github-actions-env-vars-in-env-vars
#
# - name: Castle Game Engine - Env CASTLE_ENGINE_PATH
# run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE/castle-engine" >> $GITHUB_ENV
# - name: Castle Game Engine - Env PATH (non-Windows)
# run: echo "PATH=$PATH:$CASTLE_ENGINE_PATH/tools/build-tool/" >> $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
- name: Package Windows
run: castle-engine package --os=win64 --cpu=x86_64 --verbose
- name: Archive Artifacts
# See https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v6
with:
name: windows-build
# Note: Keep paths that start with asterisk in double qoutes, to avoid misinterpreting as YAML reference.
# See https://stackoverflow.com/questions/19109912/yaml-do-i-need-quotes-for-strings-in-yaml
# https://yamlchecker.com/
path: "*-win64-x86_64.zip"
if-no-files-found: error
- name: Package Linux
run: castle-engine package --os=linux --cpu=x86_64 --verbose
- name: Archive Artifacts
uses: actions/upload-artifact@v6
with:
name: linux-build
path: "*-linux-x86_64.tar.gz"
if-no-files-found: error
# tests are disabled for now
#- name: Run tests
# run: ./Intact_Castle
# for future Android release build, signing step is needed
#- name: Unpack Android Secrets
# env:
# ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
# ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }}
# run: |
# echo "$ANDROID_KEYSTORE" | base64 --decode > cge.keystore
# echo "$ANDROID_SIGNING_PROPERTIES" | sed -e "s|WORKSPACE|${GITHUB_WORKSPACE}|" - > AndroidSigningProperties.txt
- name: Package Android
run: castle-engine package --target=android --verbose
- name: Archive Artifacts
uses: actions/upload-artifact@v6
with:
name: android-build
path: "*.apk"
if-no-files-found: error
release:
name: Release
runs-on: ubuntu-latest
# Only upload release if all builds, on all runners, succeeded.
needs: [build-using-docker]
steps:
- name: Download packaged releases
uses: actions/download-artifact@v6
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 "snapshot" release.
- name: Release Artifacts
if: ${{ github.ref == 'refs/heads/master' }}
run: gh release --repo ${{ github.repository }} upload snapshot --clobber *.zip *.apk *.tar.gz
env:
GH_TOKEN: ${{ github.token }}
update-release-tag:
name: Update Release Tag (make snapshot tag point to the build commit on master branch)
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v6
- name: Update Release Tag
if: ${{ github.ref == 'refs/heads/master' }}
run: |
# --force allows to overwrite previous tag
git tag --force snapshot
# --force allows to push with overwritten tag
git push --force origin snapshot