Commit 3e47b031 authored by nanahira's avatar nanahira

add add_script_diff

parent 20f4feed
...@@ -40,6 +40,48 @@ merge_databases: ...@@ -40,6 +40,48 @@ merge_databases:
paths: paths:
- test-release.cdb - test-release.cdb
add_script_diff:
stage: prepare
dependencies: []
tags:
- linux
script:
- git clone https://code.moenext.com/mycard/ygopro-scripts-888
- cd ygopro-scripts-888
- git remote add stable https://github.com/mycard/ygopro-scripts
- git fetch stable refs/heads/master
# now FETCH_HEAD is the commit of stable/master
- |
copy_out() {
target=../script/$1
if [ -f "$target" ]; then
echo "File $target already exists, skipping copy."
elif [ -f "$1" ]; then
echo "Copying $1 to $target"
cp -rn "$1" ../script/
else
echo "File $1 not found, skipping."
fi
}
for file in $(git diff --name-only --diff-filter=A FETCH_HEAD -- '*.lua'); do
copy_out "$file"
done
for file in $(git diff --name-only --diff-filter=M FETCH_HEAD -- '*.lua'); do
if [ -f "$file" ]; then
current_time =$(git log -1 --format="%ct" HEAD -- "$file")
stable_time=$(git log -1 --format="%ct" FETCH_HEAD -- "$file")
if [ -n "$current_time" ] && [ -n "$current_time" ] && [ "$current_time" -lt "$stable_time" ]; then
echo "File $file is older than stable/master, skipping copy."
else
copy_out "$file"
fi
fi
done
- cd ..
artifacts:
paths:
- script
.json: .json:
stage: prepare2 stage: prepare2
dependencies: dependencies:
...@@ -99,6 +141,7 @@ pack: ...@@ -99,6 +141,7 @@ pack:
stage: pack stage: pack
dependencies: dependencies:
- merge_databases - merge_databases
- add_script_diff
- json - json
- json2 - json2
tags: tags:
...@@ -129,6 +172,7 @@ server: ...@@ -129,6 +172,7 @@ server:
stage: pack stage: pack
dependencies: dependencies:
- merge_databases - merge_databases
- add_script_diff
tags: tags:
- linux - linux
script: script:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment