forked from Adeptus-Dominus/ChapterMaster
-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (108 loc) · 4 KB
/
Copy pathgamemaker_build.yml
File metadata and controls
126 lines (108 loc) · 4 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
name: Build GameMaker Project
on:
workflow_dispatch:
inputs:
yyc:
required: false
type: boolean
default: false
workflow_call:
inputs:
yyc:
required: false
type: boolean
default: false
build_date:
required: true
type: string
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
fetch-tags: true
# Causing issues with the stable release workflow;
# - name: fetch tags
# run: git fetch --tags origin
- name: Set date-time and version info
id: version_info
shell: pwsh
run: |
# Generate current date-time directly in the format you want
Write-Output "GITHUB_EVENT_NAME is: $env:GITHUB_EVENT_NAME"
if (-not "${{ inputs.build_date }}") {
$BuildDate = (Get-Date).ToString("yyyy-MM-dd-HHmm")
Write-Output "No build date provided. Using current date: $BuildDate"
} else {
$BuildDate = "${{ inputs.build_date }}"
Write-Output "Using provided build date: $BuildDate"
}
$CommitHash = git rev-parse --short HEAD
try {
$Version = "${{ github.ref_name }}".Split('/')[-1]
} catch {
# If no tags exist, use the commit hash as the version
Write-Warning "No tags found, using commit hash as version."
$Version = $CommitHash
}
# Set the version number
if ($Version -match "^v") {
$suffix = $Version
} else {
$suffix = "$Version-$BuildDate"
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "suffix=$suffix"
Write-Output "Suffix: $suffix"
# Create the version.json content
$VersionJson = @{
version = $Version
build_date = $BuildDate
commit_hash = $CommitHash
} | ConvertTo-Json
# Write the version.json to disk
Set-Content -Path datafiles/main/version.json -Value $VersionJson
# This step finds the yyp file in the repository and saves the path to an output
- id: find_yyp
name: Find The yyp File
run: |
# Search for .yyp file recursively in the repository
$yypFiles = Get-ChildItem -Path ${{ github.workspace }} -Recurse -Filter ChapterMaster.yyp
# Check if the file was found
if ($yypFiles.Count -eq 0) {
Write-Error "No .yyp file found in the repository"
exit 1
}
$yypPath = $yypFiles[0].FullName
if ($yypFiles.Count -gt 1) {
Write-Host "::warning:: Multiple .yyp files found. Using the first one: $yypPath"
}
# If found, output the path of the .yyp file
Write-Output "YYP file found at: $yypPath"
"yyp-path=$yypPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
# This step sets up the GameMaker build CLI tool Igor https://github.com/bscotch/igor-setup
- id: igor_setup
name: Setup Igor
uses: bscotch/igor-setup@v1.2.1
with:
target-yyp: ${{ steps.find_yyp.outputs.yyp-path }}
access-key: ${{ secrets.GM_ACCESS_KEY }}
# Update the version.json file with build date and other versioning information
- id: igor_build
name: Build with Igor
uses: bscotch/igor-build@v1.1.0
with:
yyp-path: ${{ steps.find_yyp.outputs.yyp-path }}
user-dir: ${{ steps.igor_setup.outputs.user-dir }}
name: ChapterMaster-${{ steps.version_info.outputs.suffix }}-Windows.zip
yyc: ${{ inputs.yyc }}
# Upload built file as an artifact
- name: Upload built file as artifact
uses: actions/upload-artifact@v4
with:
name: built-file
path: ${{ steps.igor_build.outputs.out-dir }}
retention-days: 1