Skip to content

Merge pull request #144 from mr-guard/map-workaround #154

Merge pull request #144 from mr-guard/map-workaround

Merge pull request #144 from mr-guard/map-workaround #154

Workflow file for this run

name: Build
on:
push:
branches:
- master
- experimental
- map-workaround
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (windows)
run: npm run pack:windows
- name: Zip Artifacts (windows)
run: powershell Compress-Archive -Path 'build/*' -DestinationPath 'server-manager.zip'
- name: Archive build artifacts (windows)
uses: actions/upload-artifact@v2
with:
name: server-manager-windows
path: ./server-manager.zip
build-windows-debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Set mod debug flags
run: |
echo "#define DayZServerManager" > "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG_CONTAINER" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
- name: Set manager debug flags
run: |
echo "export const dzsmDebugHttp = true;" > "src/config/constants.ts"
echo "export const dzsmDebugLogReader = true;" >> "src/config/constants.ts"
echo "export const dzsmDebugProcessList = true;" >> "src/config/constants.ts"
- name: Build
run: npm run build
- name: Pack (windows)
run: npm run pack:windows
- name: Zip Artifacts (windows)
run: powershell Compress-Archive -Path 'build/*' -DestinationPath 'server-manager.zip'
- name: Archive build artifacts (windows)
uses: actions/upload-artifact@v2
with:
name: server-manager-windows-debug
path: ./server-manager.zip
build-ubuntu-18:
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
env:
npm_config_cache: ./.npm-cache
PKG_CACHE_PATH: ./.pkg-cache
steps:
- uses: actions/checkout@v2
- name: Install build tools
run: |
apt-get update && \
apt-get install -y \
make \
python3 \
python \
build-essential \
libvorbisenc2 \
liblzo2-dev \
libvorbisfile3 \
libuchardet-dev \
curl \
zip \
&& \
chmod -R 777 . && \
chown -R 777 "/github/home"
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
# uses: arma-actions/mikero-tools@latest
run: |
mkdir -p /opt/mikero-tools
curl -fsSL "https://raw.githubusercontent.com/arma-actions/mikero-tools/latest/linux/depbo-tools-0.9.13-linux-amd64.tgz" -o depbo-tools.tgz
tar -zxf depbo-tools.tgz --strip-components=1 -C /opt/mikero-tools
echo "Updating environment variables"
echo "/opt/mikero-tools/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/mikero-tools/lib" >> $GITHUB_ENV
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (ubuntu-18)
run: npm run pack:linux
- name: Zip Artifacts (ubuntu-18)
run: zip -r server-manager.zip build/*
- name: Archive build artifacts (ubuntu-18)
uses: actions/upload-artifact@v2
with:
name: server-manager-ubuntu-18
path: ./server-manager.zip
build-ubuntu-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install build tools
run: sudo apt-get install -y make python3 python2 build-essential
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (ubuntu latest)
run: npm run pack:linux
- name: Zip Artifacts (ubuntu latest)
run: zip -r server-manager.zip build/*
- name: Archive build artifacts (ubuntu latest)
uses: actions/upload-artifact@v2
with:
name: server-manager-ubuntu-latest
path: ./server-manager.zip
build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build-ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifacts (ubuntu latest)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-latest
- name: Unpack artifact
run: unzip server-manager.zip
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Test
run: npm test | tee test-output.log ; test ${PIPESTATUS[0]} -eq 0
- name: Prepare coverage badge
if: contains('refs/heads/master refs/heads/experimental', github.ref)
run: |
SUMMARY="$(cat test-output.log | tail -3 | head -1)"
TOKENS=($SUMMARY)
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV
REF=${{ github.ref }}
echo "github.ref: $REF"
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo $BRANCH_NAME
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Create the Badge
uses: schneegans/[email protected]
if: contains('refs/heads/master refs/heads/experimental', github.ref)
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 442a5cdea03dd79a87b34339a7a16a2c
filename: dayz-server-manager__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: typescript
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- test
- build-ubuntu-18
- build-ubuntu-latest
- build-windows
- build-windows-debug
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Download artifacts (windows)
uses: actions/download-artifact@v2
with:
name: server-manager-windows
- name: Rename
run: |
mv server-manager.zip server-manager-windows.zip
- name: Upload Release Asset (Windows)
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-windows.zip
asset_name: server-manager-windows.zip
asset_content_type: application/zip
- name: Download artifacts (windows debug)
uses: actions/download-artifact@v2
with:
name: server-manager-windows-debug
- name: Rename
run: |
mv server-manager.zip server-manager-windows-debug.zip
- name: Upload Release Asset (Windows Debug)
id: upload-release-asset-windows-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-windows-debug.zip
asset_name: server-manager-windows-debug.zip
asset_content_type: application/zip
- name: Download artifacts (ubuntu 18)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-18
- name: Rename
run: |
mv server-manager.zip server-manager-ubuntu-18.zip
- name: Upload Release Asset (Ubuntu 18)
id: upload-release-asset-ubuntu-18
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-ubuntu-18.zip
asset_name: server-manager-ubuntu-18.zip
asset_content_type: application/zip
- name: Download artifacts (ubuntu latest)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-latest
- name: Rename
run: |
mv server-manager.zip server-manager-ubuntu-latest.zip
- name: Upload Release Asset (Ubuntu latest)
id: upload-release-asset-ubuntu-latest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-ubuntu-latest.zip
asset_name: server-manager-ubuntu-latest.zip
asset_content_type: application/zip