-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (109 loc) · 4.19 KB
/
build.yml
File metadata and controls
123 lines (109 loc) · 4.19 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
name: Build and Release Spectrum Server
on:
schedule:
# UTC 15:00 = NZDT 4:00 AM (NZST ~3 AM)
- cron: "0 15 * * *"
workflow_dispatch:
inputs:
build_type:
description: "Build type"
required: true
default: dev
type: choice
options:
- dev
- release
version:
description: "Version tag (required for release builds, e.g. v1.2.3)"
required: false
type: string
jobs:
export_spectrum:
name: Build Spectrum Server
runs-on: ubuntu-latest
permissions:
contents: write
env:
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.build_type == 'release' }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
lfs: true
fetch-depth: 0
ref: ${{ env.IS_RELEASE == 'true' && 'master' || 'dev' }}
- name: Compute build version
id: version
run: |
if [[ "${{ env.IS_RELEASE }}" == "true" ]]; then
if [[ -z "${{ inputs.version }}" ]]; then
echo "❌ Release builds require a version"
exit 1
fi
echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
DATE=$(date -u +"%Y%m%d")
SHA=$(git rev-parse --short HEAD)
echo "VERSION=dev-${DATE}-${SHA}" >> $GITHUB_OUTPUT
fi
- name: install wine
id: wine_install
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y wine64 wine32
echo "WINE_PATH=$(which wine)" >> $GITHUB_OUTPUT
- name: Export Spectrum
id: export
uses: firebelley/godot-export@v7.0.0
with:
godot_executable_download_url: https://github.com/not-my-username/godot/releases/download/4.5.2-so_reusraddr/godot.linuxbsd.editor.x86_64.zip
godot_export_templates_download_url: https://github.com/not-my-username/godot/releases/download/4.5.2-so_reusraddr/4.5.2.stablereuseaddr.zip
relative_project_path: ./
archive_output: true
cache: true
presets_to_export: windows.x86_64, macOS.universal, linux.x86_64
wine_path: ${{ steps.wine_install.outputs.WINE_PATH }} # set the wine path here which is the output of the wine_install step
- name: Rename Archives
run: |
cd ${{ steps.export.outputs.archive_directory }}
mv linux.x86_64.zip SpectrumServer.x86_64.linux.${{ steps.version.outputs.VERSION }}.zip
mv windows.x86_64.zip SpectrumServer.x86_64.windows.${{ steps.version.outputs.VERSION }}.zip
mv macOS.universal.zip SpectrumServer.universal.macOS.${{ steps.version.outputs.VERSION }}.zip
- name: Tag current commit for Latest Dev Build
if: env.IS_RELEASE != 'true'
run: |
TAG_NAME=latest-dev-build
# Delete local tag if it exists
git tag -d $TAG_NAME || true
# Delete remote tag if it exists
git push origin :refs/tags/$TAG_NAME || true
# Tag the current commit
git tag $TAG_NAME $GITHUB_SHA
git push origin $TAG_NAME
- name: Update "Latest dev build" release
if: env.IS_RELEASE != 'true'
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest-dev-build
name: latest-dev-release
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true
artifacts: ${{ steps.export.outputs.archive_directory }}/*
- name: Create git tag
if: env.IS_RELEASE == 'true'
run: |
git tag ${{ steps.version.outputs.VERSION }}
git push origin ${{ steps.version.outputs.VERSION }}
- name: Create GitHub Release
if: env.IS_RELEASE == 'true'
uses: ncipollo/release-action@v1.14.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.version.outputs.VERSION }}
name: ${{ steps.version.outputs.VERSION }}
generateReleaseNotes: true
artifacts: ${{ steps.export.outputs.archive_directory }}/*