-
Notifications
You must be signed in to change notification settings - Fork 315
166 lines (142 loc) · 4.69 KB
/
export.yml
File metadata and controls
166 lines (142 loc) · 4.69 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# SPDX-FileCopyrightText: The Threadbare Authors
# SPDX-License-Identifier: MPL-2.0
name: "Build and Export Game"
on:
workflow_dispatch:
inputs:
build_flatpak:
description: "Also build a Flatpak bundle"
type: boolean
pull_request:
release:
types:
- published
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
env:
PCK_NAME: threadbare
jobs:
build:
name: Build for web
runs-on: ubuntu-latest
outputs:
linux-changed: ${{ steps.changes.outputs.linux }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# TODO: can we use --filter to avoid fetching the trees & blobs for
# all historical commits, while still fetching the commit history &
# tags?
fetch-depth: 0
fetch-tags: true
- name: Create Git LFS file list
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
- name: Restore Git LFS object cache
uses: actions/cache@v5
with:
path: .git/lfs
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
restore-keys: |
${{ runner.os }}-lfsdata-v1-
${{ runner.os }}-lfsdata
- name: Fetch any needed Git LFS objects and prune extraneous ones
run: git lfs fetch --prune
- name: Check out Git LFS content
run: git lfs checkout
- id: changes
uses: dorny/paths-filter@v4
with:
filters: |
linux:
- 'linux/**'
- .github/workflows/export.yml
- name: Export web build
uses: endlessm/godot-export-action@v1
with:
godot_version: "4.6.2"
- name: Check GDScript diagnostics
run: |
python tools/check-gdscript-lsp-diagnostics.py --godot build/godot || \
echo "::warning::GDScript diagnostics check failed (exit code $?)"
- name: Upload web artifact
uses: actions/upload-artifact@v7
with:
name: web
path: build/web
flatpak:
name: Build Flatpak
needs: build
if: ${{ inputs.build_flatpak || github.event_name == 'release' || needs.build.outputs.linux-changed == 'true' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
options: --privileged
steps:
- uses: actions/checkout@v6
with:
lfs: true
sparse-checkout: |
linux
- name: Download Artifact
uses: actions/download-artifact@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
name: web
path: build
- name: Rename pck file
run: |
mv build/index.pck build/threadbare.pck
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: threadbare.flatpak
manifest-path: linux/org.endlessaccess.threadbare.yml
cache-key: "flatpak-builder-${{ github.sha }}"
- name: Create Linux metadata bundle
run: |
tar --create --gzip \
--dereference \
--file threadbare-linux-metadata.tar.gz \
--transform=s,^,threadbare-linux-metadata/, \
linux/*
- name: Upload Linux metadata bundle
uses: actions/upload-artifact@v7
with:
path: threadbare-linux-metadata.tar.gz
archive: false
release:
name: Attach to release
needs: [build, flatpak]
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Download web bundle
uses: actions/download-artifact@v8
with:
name: web
skip-decompress: true
- name: Download Flatpak bundle
uses: actions/download-artifact@v8
with:
name: threadbare-x86_64.flatpak
- name: Download Linux metadata bundle
uses: actions/download-artifact@v8
with:
name: threadbare-linux-metadata.tar.gz
- name: Attach assets to release
shell: bash
run: |
set -ex
unzip web.zip index.pck
mv index.pck 'threadbare-${{ github.ref_name }}.pck'
mv web.zip 'threadbare-${{ github.ref_name }}-web.zip'
mv threadbare.flatpak 'threadbare-${{ github.ref_name }}-x86_64.flatpak'
mv threadbare-linux-metadata.tar.gz 'threadbare-${{ github.ref_name }}-linux-metadata.tar.gz'
for file in threadbare-${{ github.ref_name }}*; do
gh release upload '${{ github.ref_name }}' "$file" --repo '${{ github.repository }}'
done