-
Notifications
You must be signed in to change notification settings - Fork 1
ReleaseProcess
k4nagatsuki edited this page Jan 3, 2017
·
14 revisions
CardWirthPyのリリース作業は次の手順で行っています。
- このリポジトリから全体をクローンする。
-
ChangeLog.txtを更新(リリースの日付を入れ、更新内容漏れは書き加える)。 -
ReadMe.txtの内容がリリースに合っているか確認し、必要なら更新する。 - 次の箇所にあるバージョン表記が現状に合っているか確認し、合っていなければ更新する。
-
ReadMe.txt冒頭 -
build_exe.pyのBuildExe#project_version -
cw/__init__.pyのAPP_VERSION Data/SystemCoupons.xml
-
- コミットし、タグをつける(どのようなタグをつければよいかは
hg tagsを参照してください)。 - このリポジトリへpushする。
-
msvcp90.dll、msvcr90.dll、gdiplus.dllをフォルダに入れる(ビルドに必要)。 -
python build_exe.pyを実行。 -
CardWirthPy/Data/SkinフォルダにClassicスキンを入れる。 - 同フォルダにClassicスキン以外の標準添付スキンを入れる。
- シナリオ「交易都市リューン」「ゴブリンの洞窟」及び著作権情報を記したテキストを
Scenario/Askフォルダに入れる。 - 標準添付スキン付属のシナリオを
Scenarioフォルダに入れる。 - 必要なら上書きアップデート用の差分を作る。
License.txtは忘れずに入れること。
以上の作業を間違いなく行うのは結構手間なので、スクリプトでも作って自動的に行う方がよいでしょう。
私(@k4nagatsuki)は以下のようなバッチファイルを使用しています。このバッチファイルを個々人の環境で使用するには冒頭の各変数を環境に合わせて変更する必要があるでしょう。
rem 作業用フォルダ。リリース用のアーカイブもここに生成される。
rem このスクリプトではデスクトップを使用。
set DEST_DIR=%USERPROFILE%\Desktop
rem 圧縮に使用するツール。このスクリプトでは7-Zipを使用。
set ARCHIVER="C:\Program Files\7-Zip\7z" a -tzip
rem 開発用に普段使用している作業用ローカルリポジトリ。
set LOCAL_REPO=%PROGRAMMING_WORKSPACE%\CardWirthPyReboot\src
rem BitbucketのユーザID。
set USER=k4nagatsuki
rem メインストリームのリポジトリのアドレス。
set MAIN_REPO=https://%USER%@bitbucket.org/k4nagatsuki/cardwirthpy-reboot
rem 差分作成用の情報。%OLDVERSION_PATH%には
rem 過去にリリースしたアーカイブを展開したものを置く。
set OLDVERSION=0.12.2
set OLDVERSION_PATH=%PROGRAMMING_WORKSPACE%\archive\CardWirthPy_%OLDVERSION%
rem 差分作成用のPythonスクリプトのパス。
set DIRDIFF=%PROGRAMMING_WORKSPACE%\dirdiff.py
rem バージョン情報などの編集に使うエディタ。
set EDITOR=notepad
rem 標準添付スキンがあるフォルダ
set SKIN_DIR=%LOCAL_REPO%\Data\Skin
rem Askシナリオと標準添付スキン付属シナリオがあるフォルダ
set SCENARIO_DIR=%LOCAL_REPO%\Scenario
rem -----------------------------------------------------------------------
pushd %DEST_DIR%
hg clone %LOCAL_REPO% cardwirthpy-reboot
cd cardwirthpy-reboot
%EDITOR% ChangeLog.txt
%EDITOR% ReadMe.txt
%EDITOR% build_exe.py
%EDITOR% cw\__init__.py
%EDITOR% Data\SystemCoupons.xml
hg commit -u %USER%
hg tag -u %USER% release_%1
hg push %MAIN_REPO%
copy %LOCAL_REPO%\msvcp90.dll .
copy %LOCAL_REPO%\msvcr90.dll .
copy %LOCAL_REPO%\gdiplus.dll .
python build_exe.py py2exe -nokey
xcopy /e %LOCAL_REPO%\Data\Skin\Classic CardWirthPy\Data\Skin\Classic\
xcopy /e %SKIN_DIR%\BloodWirth CardWirthPy\Data\Skin\BloodWirth\
xcopy /e %SKIN_DIR%\JUDGMENT CardWirthPy\Data\Skin\JUDGMENT\
xcopy /e %SCENARIO_DIR%\Ask CardWirthPy\Scenario\Ask\
xcopy /e %SCENARIO_DIR%\BloodWirth CardWirthPy\Scenario\BloodWirth\
python %DIRDIFF% CardWirthPy %OLDVERSION_PATH% ..\CardWirthPy
copy License.txt ..\CardWirthPy\
%ARCHIVER% ..\CardWirthPy_%1.zip CardWirthPy
%ARCHIVER% ..\CardWirthPy_%OLDVERSION%_to_%1.zip ..\CardWirthPy
cd ..
rmdir /Q /S cardwirthpy-reboot
rmdir /Q /S CardWirthPy
pushd %LOCAL_REPO%
hg pull upstream --update
hg pushこのスクリプト内で使用されているスクリプトdirdiff.pyは、2つのフォルダを比較して変更・追加されたファイルだけをアーカイブするもので、以下のような内容です。
import os
import sys
import shutil
if len(sys.argv) < 3:
print "usage: python dirdiff.py <new> <old> [<target>]"
sys.exit(0)
dpath1 = sys.argv[1]
dpath2 = sys.argv[2]
print "Create DirDiff:"
print " New: %s" % (dpath1)
print " Old: %s" % (dpath2)
if len(sys.argv) < 4:
target = "dirdiffed"
else:
target = sys.argv[3]
def recurse(dpath1, dpath2, target):
for fpath in os.listdir(dpath1):
fpath1 = os.path.join(dpath1, fpath)
fpath2 = os.path.join(dpath2, fpath)
target2 = os.path.join(target, fpath)
if not os.path.exists(fpath2):
print "not found: %s" % (fpath1)
if not os.path.isdir(os.path.dirname(target2)):
os.makedirs(os.path.dirname(target2))
if os.path.isdir(fpath1):
shutil.copytree(fpath1, target2)
else:
shutil.copy2(fpath1, target2)
elif os.path.isdir(fpath1):
recurse(fpath1, fpath2, target2)
else:
#if os.path.getmtime(fpath1) <> os.path.getmtime(fpath2):
with open(fpath1, "rb") as f1:
with open(fpath2, "rb") as f2:
if f1.read() <> f2.read():
print "modified : %s" % (fpath1)
if not os.path.isdir(os.path.dirname(target2)):
os.makedirs(os.path.dirname(target2))
shutil.copy2(fpath1, target2)
recurse(dpath1, dpath2, target)