Last active
August 29, 2015 14:00
-
-
Save chikuchikugonzalez/97f2ceb2958154026b89 to your computer and use it in GitHub Desktop.
gitリポジトリ用MUGENキャラクターリリーススクリプト (Jenkinsビルドスクリプト)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -*- coding: utf-8 -*- | |
# | |
# settings | |
curdate=`date +%Y%m%d` | |
repo_name=mugen-${char_name,,} | |
repo=${WORKSPACE}/${repo_name}.git | |
workdir=${WORKSPACE}/${char_name} | |
distdir=$(dirname "${WORKSPACE}")/releases | |
archive=${distdir}/${char_name}-${char_version}-r${curdate}.zip | |
readmes=$(dirname "${WORKSPACE}")/mugen-readme.git | |
readme_script=${readmes}/ReadmeTemplate.php | |
# Clone from Repository | |
if [ ! -d "${repo}" ]; then | |
git clone [email protected]:chiku2gonzalez/${repo_name}.git ${repo} | |
#pushd ${repo} | |
#git reset --hard | |
#git pull [email protected]:chiku2gonzalez/${repo_name}.git | |
#popd | |
fi | |
# Checkout Target Version | |
pushd ${repo} | |
git reset --hard | |
git checkout master | |
git pull origin | |
git checkout ${char_version} | |
if [ -d "${workdir}" ]; then | |
# Remove old files | |
pushd "${workdir}" | |
rm -rf * | |
popd | |
fi | |
git checkout-index --all --prefix="${workdir}/" | |
popd | |
# Generate Readme | |
if [ -d "${readmes}" ]; then | |
if [ -f "${readme_script}" ] && [ -f "${workdir}/Readme.conf.xml" ]; then | |
php -f ${readme_script} ${workdir}/Readme.conf.xml > ${workdir}/Readme.txt | |
fi | |
if [ -f "${workdir}/Readme.conf.xml" ]; then | |
rm "${workdir}/Readme.conf.xml" | |
fi | |
# Copy Docs | |
for txt in ${readmes}/*.txt; do | |
cp ${txt} ${workdir}/$(basename ${txt}) | |
done | |
fi | |
# Archive to 7z | |
if [ ! -d "${distdir}" ]; then | |
mkdir -p ${distdir} | |
fi | |
#pushd ${workdir} | |
pushd ${WORKSPACE} | |
zip -9 -r "${archive}" ${char_name}/* | |
popd | |
# vim: set sts=4 ts=4 sw=4 expandtab: |
展開時にデスクトップぶちまけ対策しておいた
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
7-zip (7zr) が文字コード問題起こすのでzipで