-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (78 loc) · 3.73 KB
/
main.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
name: CI
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Enter shell with needed dependencies
run: |
nix shell --inputs-from . nixpkgs#jq nixpkgs#p7zip nixpkgs#git nixpkgs#findutils
- name: Update Doom2D related inputs
run: |
nix flake update d2df-sdl d2df-editor doom2df-res
D2DF_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."d2df-sdl".locked.rev')
EDITOR_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."d2df-editor".locked.rev')
RES_REV=$(nix flake metadata . --json 2>/dev/null | jq --raw-output '.locks.nodes."doom2df-res".locked.rev')
git clone https://repo.or.cz/d2df-sdl
git clone https://repo.or.cz/d2df-editor
git clone https://github.com/Doom2D/DF-Res
D2DF_LAST_COMMIT_DATE=$(git --git-dir d2df-sdl/.git log $D2DF_REV --format="%ad" --date=iso)
EDITOR_LAST_COMMIT_DATE=$(git --git-dir d2df-editor/.git log $EDITOR_REV --format="%ad" --date=iso)
RES_LAST_COMMIT_DATE=$(git --git-dir DF-res/.git log $RES_REV --format="%ad" --date=iso)
echo "D2DF_REV=$D2DF_REV" >> "$GITHUB_ENV"
echo "EDITOR_REV=$RES_REV" >> "$GITHUB_ENV"
echo "RES_REV=$RES_REV" >> "$GITHUB_ENV"
echo "D2DF_LAST_COMMIT_DATE=\"$D2DF_LAST_COMMIT_DATE\"" >> "$GITHUB_ENV"
echo "EDITOR_LAST_COMMIT_DATE=\"$EDITOR_LAST_COMMIT_DATE\"" >> "$GITHUB_ENV"
echo "RES_LAST_COMMIT_DATE=\"$RES_LAST_COMMIT_DATE\"" >> "$GITHUB_ENV"
printf 'This build has the following inputs:\nd2df-sdl: %s\ndoom2d-res: %s\nd2df-editor: %s' $D2DF_REV $RES_REV $EDITOR_REV > release_body
- name: Build debug APK
run: |
nix build .#legacyPackages.x86_64-linux.android.doom2df-sdl2_mixer-apk
cp result doom2df-android.apk
- uses: actions/upload-artifact@v4
with:
name: doom2df-android
path: result
if-no-files-found: error
- name: Build Windows 32-bit ZIP bundle
run: |
mkdir -p doom2df-win32 build/assets build/bin
nix build .#legacyPackages.x86_64-linux.mingw.byArch.mingw32.gameAssetsPath
cp result/* build/assets/
nix build .#legacyPackages.x86_64-linux.mingw.byArch.mingw32.gameExecutablePath
cp result/* build/bin/
find . -type f -iname 'doom2df*' -exec touch -d "${{env.D2DF_LAST_COMMIT_DATE}}" {} \;
find . -type f -iname 'editor*' -exec touch -d "${{env.EDITOR_LAST_COMMIT_DATE}}" {} \;
find . -type f -exec touch -d "${{env.RES_LAST_COMMIT_DATE}}"" {} \;
cp build/bin/* doom2df-win32
cp build/assets/* doom2df-win32
rm -rf build
7z a -mtm -stl -ssp -tzip doom2df-win32.zip -w doom2df-win32/.
rm doom2df-win32/
- uses: actions/upload-artifact@v4
with:
name: doom2df-win32
path: doom2df-win32.zip
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch'}}
with:
artifacts: doom2df-win32.zip, doom2df-android.apk
token: ${{ secrets.GITHUB_TOKEN }}
name: Doom2D Forever builds (latest commit)
bodyFile: release_body
tag: doom2dforever
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true