-
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (138 loc) · 5.29 KB
/
Copy pathweekly-release.yml
File metadata and controls
168 lines (138 loc) · 5.29 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
167
# Modified by NetHackJP contributor @satokiyon; latest change date: 2026-09-06.
name: Weekly Release
on:
schedule:
- cron: '0 18 * * FRI' # AM 03:00 JST (Fri 18:00 UTC)
workflow_dispatch:
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build NetHack (x64 Release)
run: msbuild sys/windows/vs/NetHack.sln /p:Configuration=Release /p:Platform=x64
- name: Get current date
id: date
run: |
$jst = [TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTime]::UtcNow, 'Tokyo Standard Time')
$date = $jst.ToString("yyyyMMdd")
echo "DATE_STR=$date" >> $env:GITHUB_ENV
shell: powershell
- name: Prepare package
run: |
$outDir = "binary/Release/x64"
$zipPath = "NetHackJP-5.0.0-${{ env.DATE_STR }}-windows.zip"
# Copy Guidebook_JP.txt to the output directory
if (Test-Path "Guidebook_JP.txt") {
Copy-Item "Guidebook_JP.txt" -Destination "$outDir\"
} else {
Write-Warning "Guidebook_JP.txt not found!"
}
# Create ZIP archive
Compress-Archive -Path "$outDir\*" -DestinationPath $zipPath
shell: powershell
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: nethack-windows-zip
path: NetHackJP-5.0.0-*-windows.zip
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y build-essential bison flex libncurses-dev uuid-dev pkg-config \
libx11-dev libxaw7-dev libxt-dev libxpm-dev libxft-dev libfontconfig1-dev xfonts-utils zip curl
- name: Build NetHackJP (Linux)
run: |
chmod +x sys/unix/build_wsl.sh
./sys/unix/build_wsl.sh sys/unix/hints/linux-jp
make install
- name: Prepare package
run: |
DATE_STR=$(TZ='Asia/Tokyo' date +"%Y%m%d")
DIST_DIR="NetHackJP-5.0.0-${DATE_STR}-linux"
ZIP_NAME="${DIST_DIR}.zip"
# Copy installed playground content to distribution directory
cp -r playground "${DIST_DIR}"
# Add Guidebook_JP.txt if exists
if [ -f "Guidebook_JP.txt" ]; then
cp "Guidebook_JP.txt" "${DIST_DIR}/"
fi
# Create portable launcher scripts (nethack for TTY/curses, nethackW for X11 GUI)
cd "${DIST_DIR}"
if [ -f "nethack" ]; then
mv nethack nethack.bin
fi
{
echo '#!/bin/sh'
echo 'SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"'
echo 'export HACKDIR="$SCRIPT_DIR"'
echo 'export NETHACKDIR="$SCRIPT_DIR"'
echo 'export XAPPLRESDIR="$SCRIPT_DIR"'
echo 'exec "$SCRIPT_DIR/nethack.bin" "$@"'
} > nethack
{
echo '#!/bin/sh'
echo 'SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"'
echo 'export HACKDIR="$SCRIPT_DIR"'
echo 'export NETHACKDIR="$SCRIPT_DIR"'
echo 'export XAPPLRESDIR="$SCRIPT_DIR"'
echo '[ -z "$XMODIFIERS" ] && export XMODIFIERS="@im=fcitx"'
echo 'if ! pgrep -a fcitx5 >/dev/null 2>&1 && ! pgrep -a fcitx >/dev/null 2>&1; then'
echo ' echo "注意: fcitx5 が起動していません。GUIダイアログで日本語入力を行う場合は、" >&2'
echo ' echo " 事前に \"fcitx5 --disable=wayland,waylandim -d\" を実行してください。" >&2'
echo 'fi'
echo 'exec "$SCRIPT_DIR/nethack.bin" -wX11 -bg black -fg white -bd white "$@"'
} > nethackW
chmod +x nethack nethackW nethack.bin
cd ..
zip -r "${ZIP_NAME}" "${DIST_DIR}"
- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
with:
name: nethack-linux-zip
path: NetHackJP-5.0.0-*-linux.zip
create-release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Organize release files
run: |
mkdir -p release_files
find artifacts -type f -name "*.zip" -exec cp {} release_files/ \;
ls -la release_files/
- name: Get current date
id: date
run: |
echo "DATE_STR=$(TZ='Asia/Tokyo' date +"%Y%m%d")" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: NetHackJP-5.0.0-${{ steps.date.outputs.DATE_STR }}
name: NetHackJP 5.0.0 Weekly Build (${{ steps.date.outputs.DATE_STR }})
body_path: release_readme.txt
generate_release_notes: true
files: |
release_files/*.zip
release_readme.txt
draft: false
prerelease: false