make the github build process produce usable zips [rebuild]

This commit is contained in:
Dustin Carlino 2020-01-11 16:07:19 -06:00
parent f1b42ecdb9
commit c039aed4d0
7 changed files with 57 additions and 93 deletions

View File

@ -11,11 +11,13 @@ jobs:
rust-version: 1.40.0
- name: Run build
run: cargo build --release --bin game
- name: Upload binary
- name: Package release
run: ./release/build.sh abst_windows play_abstreet.bat target/release/game.exe
- name: Upload release
uses: actions/upload-artifact@v1
with:
name: game_windows.exe
path: target/release/game.exe
name: abst_windows.zip
path: abst_windows.zip
build-macos:
runs-on: macos-latest
if: "contains(github.event.head_commit.message, '[rebuild]')"
@ -26,11 +28,13 @@ jobs:
rust-version: 1.40.0
- name: Run build
run: cargo build --release --bin game
- name: Upload binary
- name: Package release
run: ./release/build.sh abst_mac play_abstreet.sh target/release/game
- name: Upload release
uses: actions/upload-artifact@v1
with:
name: game_mac
path: target/release/game
name: abst_mac.zip
path: abst_mac.zip
build-linux:
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[rebuild]')"
@ -41,8 +45,10 @@ jobs:
rust-version: 1.40.0
- name: Run build
run: cargo build --release --bin game
- name: Upload binary
- name: Package release
run: ./release/build.sh abst_linux play_abstreet.sh target/release/game
- name: Upload release
uses: actions/upload-artifact@v1
with:
name: game_linux
path: target/release/game
name: abst_linux.zip
path: abst_linux.zip

18
data/package_for_releases.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Run from the base repo directory: ./data/package_for_releases.sh
set -e
if [ "$USER" != "dabreegster" ]; then
echo "Only Dustin runs this script, to automate releases.";
exit 1;
fi
mkdir release_data
cp -Rv data/system release_data
# Not worth blowing up the download size yet
rm -rfv release_data/system/maps/huge_seattle.bin release_data/system/scenarios/huge_seattle
zip -r release_data release_data
rm -rf release_data
echo "Fire at will: mv release_data.zip ~/Dropbox"

24
release/build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Called by Github Actions workflow
set -e
output=$1;
runner=$2;
binary=$3;
mkdir $output
curl -L -o release_data.zip https://www.dropbox.com/s/wzw7gucvccoxy66/release_data.zip?dl=0
cd $output
unzip ../release_data.zip
mv release_data data
cd ..
cp docs/INSTRUCTIONS.md $output
cp release/$runner $output
mkdir $output/game
cp $binary $output/game
cp -Rv game/assets $output/game
zip -r $output $output
rm -rf $output release_data.zip

View File

@ -1,13 +0,0 @@
function common_release {
OUT=$1;
rm -rfv $OUT
mkdir $OUT
cp docs/INSTRUCTIONS.md $OUT
mkdir -p $OUT/data
cp -Rv data/system $OUT/data
# Not worth blowing up the download size yet
rm -rfv $OUT/data/system/maps/huge_seattle.bin $OUT/data/system/scenarios/huge_seattle
}

View File

@ -1,25 +0,0 @@
#!/bin/bash
# Call from project root directory: ./release/linux.sh
set -e
version=$1;
if [ "$version" == "" ]; then
echo Gimme version number
exit 1
fi
OUT="abstreet_linux_$version"
source release/common.sh
common_release $OUT
cp release/play_abstreet.sh $OUT
mkdir $OUT/game
cross build --release --target x86_64-unknown-linux-gnu --bin game
cp target/x86_64-unknown-linux-gnu/release/game $OUT/game
cp -Rv game/assets $OUT/game
zip -r $OUT $OUT
rm -rf $OUT

View File

@ -1,21 +0,0 @@
#!/bin/bash
# Call from project root directory: ./release/mac.sh
set -e
version=$1;
if [ "$version" == "" ]; then
echo Gimme version number
exit 1
fi
OUT="abstreet_mac_$version"
dtrx abstreet_linux_$version.zip
mv abstreet_linux_$version $OUT
rm -fv $OUT/game/game
cp /media/dabreegster/PATRIOTUSB/game $OUT/game
chmod +x $OUT/game/game
zip -r $OUT $OUT
rm -rf $OUT

View File

@ -1,25 +0,0 @@
#!/bin/bash
# Call from project root directory: ./release/windows.sh
set -e
version=$1;
if [ "$version" == "" ]; then
echo Gimme version number
exit 1
fi
OUT="abstreet_windows_$version"
source release/common.sh
common_release $OUT
cp release/play_abstreet.bat $OUT
mkdir $OUT/game
cross build --release --target x86_64-pc-windows-gnu --bin game
cp target/x86_64-pc-windows-gnu/release/game.exe $OUT/game
cp -Rv game/assets $OUT/game
zip -r $OUT $OUT
rm -rf $OUT