Add release steps
This commit is contained in:
parent
ae16d8f5ac
commit
c8c1348427
|
|
@ -1,5 +1,11 @@
|
|||
name: CI
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
|
|
@ -29,11 +35,15 @@ jobs:
|
|||
with:
|
||||
compiler: ${{ matrix.dc }}
|
||||
|
||||
# Build
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
dub build --build=release --config=client --arch=${{ matrix.arch }}
|
||||
dub build --build=release --config=server --arch=${{ matrix.arch }}
|
||||
|
||||
# Tests
|
||||
|
||||
- name: Linux Tests
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
|
|
@ -48,3 +58,55 @@ jobs:
|
|||
working-directory: tests
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
# Package Release
|
||||
|
||||
- name: TarGZ MacOS and Linux
|
||||
if: github.event_name == 'release' && !contains(matrix.os, 'windows') && contains(matrix.dc, 'ldc')
|
||||
uses: thedoctor0/zip-release@0.4.2
|
||||
with:
|
||||
filename: dcd.tar.gz
|
||||
path: "dcd-client dcd-server"
|
||||
|
||||
- name: Zip Windows
|
||||
if: github.event_name == 'release' && contains(matrix.os, 'windows') && contains(matrix.dc, 'ldc')
|
||||
uses: thedoctor0/zip-release@0.4.2
|
||||
with:
|
||||
filename: dcd.zip
|
||||
path: "dcd-client.exe dcd-server.exe"
|
||||
|
||||
# Release
|
||||
|
||||
- name: Release Linux
|
||||
if: github.event_name == 'release' && contains(matrix.os, 'ubuntu') && contains(matrix.dc, 'ldc')
|
||||
uses: WebFreak001/upload-asset@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
OS: linux
|
||||
with:
|
||||
file: dcd.tar.gz
|
||||
filename: dcd-${TAG}-${OS}-${{ matrix.arch }}.tar.gz
|
||||
mime: application/tar+gzip
|
||||
|
||||
- name: Release Macos
|
||||
if: github.event_name == 'release' && contains(matrix.os, 'macos') && contains(matrix.dc, 'ldc')
|
||||
uses: WebFreak001/upload-asset@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
OS: osx
|
||||
with:
|
||||
file: dcd.tar.gz
|
||||
filename: dcd-${TAG}-${OS}-${{ matrix.arch }}.tar.gz
|
||||
mime: application/tar+gzip
|
||||
|
||||
- name: Release Windows
|
||||
if: github.event_name == 'release' && contains(matrix.os, 'windows') && contains(matrix.dc, 'ldc')
|
||||
uses: WebFreak001/upload-asset@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
OS: windows
|
||||
with:
|
||||
file: dcd.zip
|
||||
filename: dcd-${TAG}-${OS}-${{ matrix.arch }}.zip
|
||||
mime: application/zip
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build the Windows binaries under Linux
|
||||
set -eux -o pipefail
|
||||
|
||||
BIN_NAME=dcd
|
||||
|
||||
# Allow the script to be run from anywhere
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
source setup-ldc-windows.sh
|
||||
|
||||
# Run LDC with cross-compilation
|
||||
archiveName="$BIN_NAME-$VERSION-$OS-$ARCH_SUFFIX.zip"
|
||||
echo "Building $archiveName"
|
||||
mkdir -p bin
|
||||
DC=ldmd2 make ldcclient ldcserver
|
||||
|
||||
cd bin
|
||||
mv dcd-client dcd-client.exe
|
||||
mv dcd-server dcd-server.exe
|
||||
zip "$archiveName" "dcd-client.exe" "dcd-server.exe"
|
||||
23
release.sh
23
release.sh
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eux -o pipefail
|
||||
VERSION=$(git describe --abbrev=0 --tags)
|
||||
ARCH="${ARCH:-64}"
|
||||
LDC_FLAGS=()
|
||||
unameOut="$(uname -s)"
|
||||
case "$unameOut" in
|
||||
Linux*) OS=linux; LDC_FLAGS=("-flto=full" "-linker=gold" "-static") ;;
|
||||
Darwin*) OS=osx; LDC_FLAGS+=("-L-macosx_version_min" "-L10.7" "-L-lcrt1.o"); ;;
|
||||
*) echo "Unknown OS: $unameOut"; exit 1
|
||||
esac
|
||||
|
||||
case "$ARCH" in
|
||||
64) ARCH_SUFFIX="x86_64";;
|
||||
32) ARCH_SUFFIX="x86";;
|
||||
*) echo "Unknown ARCH: $ARCH"; exit 1
|
||||
esac
|
||||
|
||||
archiveName="dcd-$VERSION-$OS-$ARCH_SUFFIX.tar.gz"
|
||||
|
||||
echo "Building $archiveName"
|
||||
${MAKE:-make} ldcclient ldcserver LDC_FLAGS="${LDC_FLAGS[*]}"
|
||||
tar cvfz "bin/$archiveName" -C bin dcd-server dcd-client
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Sets up LDC for cross-compilation. Source this script, s.t. the new LDC is in PATH
|
||||
|
||||
# Make sure this version matches the version of LDC2 used in .travis.yml,
|
||||
# otherwise the compiler and the lib used might mismatch.
|
||||
LDC_VERSION="1.23.0"
|
||||
ARCH=${ARCH:-32}
|
||||
VERSION=$(git describe --abbrev=0 --tags)
|
||||
OS=windows
|
||||
|
||||
# LDC should already be installed (see .travis.yml)
|
||||
# However, we need the libraries, so download them
|
||||
# We can't use the downloaded ldc2 itself, because obviously it's for Windows
|
||||
|
||||
if [ "${ARCH}" == 64 ]; then
|
||||
ARCH_SUFFIX='x86_64'
|
||||
ZIP_ARCH_SUFFIX='x64'
|
||||
else
|
||||
ARCH_SUFFIX='i686'
|
||||
ZIP_ARCH_SUFFIX='x86'
|
||||
fi
|
||||
|
||||
LDC_DIR_PATH="$(pwd)/ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}"
|
||||
LDC_XDFLAGS="-conf=${LDC_DIR_PATH}/etc/ldc2.conf -mtriple=${ARCH_SUFFIX}-pc-windows-msvc"
|
||||
|
||||
# Step 1: download the LDC Windows release
|
||||
# Check if the user already have it (e.g. building locally)
|
||||
if [ ! -d ${LDC_DIR_PATH} ]; then
|
||||
if [ ! -d "ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z" ]; then
|
||||
wget "https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z"
|
||||
fi
|
||||
7z x "ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z" > /dev/null
|
||||
fi
|
||||
|
||||
# Step 2: Generate a config file with the proper path
|
||||
cat > ${LDC_DIR_PATH}/etc/ldc2.conf <<EOF
|
||||
default:
|
||||
{
|
||||
switches = [
|
||||
"-defaultlib=phobos2-ldc,druntime-ldc",
|
||||
"-link-defaultlib-shared=false",
|
||||
];
|
||||
post-switches = [
|
||||
"-I${LDC_DIR_PATH}/import",
|
||||
];
|
||||
lib-dirs = [
|
||||
"${LDC_DIR_PATH}/lib/",
|
||||
"${LDC_DIR_PATH}/lib/mingw/",
|
||||
];
|
||||
};
|
||||
EOF
|
||||
Loading…
Reference in New Issue