Skip to content

Instantly share code, notes, and snippets.

@chikuchikugonzalez
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chikuchikugonzalez/97f2ceb2958154026b89 to your computer and use it in GitHub Desktop.
Save chikuchikugonzalez/97f2ceb2958154026b89 to your computer and use it in GitHub Desktop.
gitリポジトリ用MUGENキャラクターリリーススクリプト (Jenkinsビルドスクリプト)
#!/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 git@bitbucket.org:chiku2gonzalez/${repo_name}.git ${repo}
#pushd ${repo}
#git reset --hard
#git pull git@bitbucket.org: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:
@chikuchikugonzalez
Copy link
Author

7-zip (7zr) が文字コード問題起こすのでzipで

@chikuchikugonzalez
Copy link
Author

展開時にデスクトップぶちまけ対策しておいた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment