-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a github action to publish a release with the autoconf file attac…
…hed.
- Loading branch information
1 parent
a345bf9
commit 210742c
Showing
10 changed files
with
163 additions
and
94 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Wrap and Release | ||
on: | ||
push: | ||
branches: master | ||
jobs: | ||
wrap-and-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Detect Version Number | ||
if: github.ref == 'refs/heads/master' # ONLY ON MASTER | ||
run: | | ||
./scripts/version-number-from-src.sh | ||
echo "VERSION_NUMBER=$( ./scripts/version-number-from-src.sh )" >> $GITHUB_ENV | ||
- name: Create Release Notes | ||
if: github.ref == 'refs/heads/master' # ONLY ON MASTER | ||
run: | | ||
cat ./scripts/ReleaseNotesTemplate.md > ReleaseNotes.md | ||
./scripts/latest-changes.sh >> ReleaseNotes.md | ||
- name: Create Release | ||
if: github.ref == 'refs/heads/master' # ONLY ON MASTER | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ env.VERSION_NUMBER }} | ||
release_name: Release v${{ env.VERSION_NUMBER }} | ||
body_path: ReleaseNotes.md | ||
|
||
- name: Upload Autoconf as Release Asset | ||
if: github.ref == 'refs/heads/master' # ONLY ON MASTER | ||
id: upload-autoconf | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above | ||
asset_path: ./ButtonHUD.conf | ||
asset_name: ButtonHUD.conf | ||
asset_content_type: text/yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## How to Install | ||
1. Scroll down the the **Assets** and click on **`ButtonHUD.conf`**, this should trigger a download for this file. | ||
1. Save the file to *`%ProgramData%\Dual Universe\Game\data\lua\autoconf\custom`*, the filename does not matter (as long as it's still .conf) | ||
1. In-game, right click your seat and go to *Advanced -> Update custom autoconf list* - If you get a YAML error, you did not follow the above directions corretly. | ||
1. Again, right click your seat and select *Advanced -> Run Custom Autoconfigure -> ButtonsHud - Dimencia and Archaegeo* | ||
1. IMPORTANT: Right click the ship and set the user control scheme to `Keyboard` (*Advanced -> Change Control Scheme -> Keyboard*). This is necessary for the HUD to work, but you can change the actual control scheme in the next step - fear not virtual joystick aces! | ||
1. Right click the seat, choose *Advanced -> Edit LUA Parameters*. Change the `userControlScheme` to the actual control scheme you wish to use (e.g. `Virtual Joystick`). You may mouse over the other parameters and set them as you wish - there are many, you should familiarize yourself with them. | ||
1. If you have a Databank installed on your vehicle you may save your parameters using the `Option 7` key (normally mapped to `ALT-7`). Saved parameters will be restored any time you upgrade the HUD to a new version. | ||
|
||
At this point you should be ready to fly! | ||
|
||
# Latest Changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e # exit on any error | ||
|
||
# determine rootdir | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | ||
ROOTDIR="$(dirname $DIR)" | ||
|
||
VERSIONS=() | ||
while read -r VERSION; do | ||
echo "[$VERSION]" 1>&2 | ||
|
||
VERSIONS+=("$VERSION") | ||
done < <(cat ${ROOTDIR}/ChangeLog.md | grep -n "^Version *[0-9]*\.[0-9]* *- *.*$") | ||
|
||
LATEST="${VERSIONS[0]}" | ||
PREVIOUS="${VERSIONS[1]}" | ||
|
||
echo "LATEST: [$LATEST], PREVIOUS: [$PREVIOUS]" 1>&2 | ||
|
||
LATESTLNO=$(echo "$LATEST" | grep -o '^[0-9]*') | ||
PREVIOUSLNO=$(echo "$PREVIOUS" | grep -o '^[0-9]*') | ||
|
||
cat ${ROOTDIR}/ChangeLog.md | head -n $(( $PREVIOUSLNO - 1)) | tail -n $(( $PREVIOUSLNO - $LATESTLNO )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on any error | ||
|
||
# Determine rootdir based on our script location | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | ||
ROOTDIR="$(dirname $DIR)" | ||
|
||
LUA_SRC=${1:-$ROOTDIR/src/ButtonHUD.lua} | ||
|
||
VERSION_NUMBER=`grep "VERSION_NUMBER = .*" $LUA_SRC | sed -E "s/\s*VERSION_NUMBER = (.*)/\1/"` | ||
if [[ "${VERSION_NUMBER}" == "" ]]; then | ||
echo "ERROR: Failed to detect version number" 2>&1; exit 1 | ||
fi | ||
|
||
echo "$VERSION_NUMBER" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,81 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on any error | ||
|
||
# Determine rootdir based on our script location | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | ||
ROOTDIR="$(dirname $DIR)" | ||
|
||
# Detect luamin binary, preferably use the local luamin, otherwise default to the global luamin | ||
LUAMIN="${ROOTDIR}/scripts/node_modules/.bin/luamin" | ||
if ! which $LUAMIN 1> /dev/null; then | ||
LUAMIN="luamin" | ||
fi | ||
if ! which $LUAMIN 1> /dev/null; then | ||
echo "ERROR: Need luamin in PATH (run \`npm install\` from the scripts/ folder)"; exit 1 | ||
fi | ||
|
||
# Parse args, or use defaults | ||
MINIFY="${1:-false}" | ||
# We expect this file to be run from the <repo>/scripts directory | ||
LUA_SRC=../src/ButtonHUD.lua | ||
CONF_DST=../ButtonHUD.conf | ||
mkdir -p work | ||
LUA_SRC=${2:-$ROOTDIR/src/ButtonHUD.lua} | ||
CONF_DST=${3:-$ROOTDIR/ButtonHUD.conf} | ||
|
||
# Make a fresh work dir | ||
WORK_DIR=${ROOTDIR}/scripts/work | ||
(rm -rf $WORK_DIR/* || true) && mkdir -p $WORK_DIR | ||
|
||
# Extract the exports because the minifier will eat them. | ||
grep "\-- \?export:" $LUA_SRC | sed -e 's/^[ \t]*/ /' -e 's/-- export:/--export:/' > work/ButtonHUD.exports | ||
grep "\-- \?export:" $LUA_SRC | sed -e 's/^[ \t]*/ /' -e 's/-- export:/--export:/' > $WORK_DIR/ButtonHUD.exports | ||
|
||
VERSION_NUMBER=`grep "VERSION_NUMBER = .*" $LUA_SRC | sed -E "s/\s*VERSION_NUMBER = (.*)/\1/"` | ||
if [[ "${VERSION_NUMBER}" == "" ]]; then | ||
echo "ERROR: Failed to detect version number"; exit 1 | ||
fi | ||
|
||
sed "/-- \?export:/d;/require 'src.slots'/d" $LUA_SRC > work/ButtonHUD.extracted.lua | ||
sed "/-- \?export:/d;/require 'src.slots'/d" $LUA_SRC > $WORK_DIR/ButtonHUD.extracted.lua | ||
|
||
# Minify the lua | ||
if "$1" == "true"; then | ||
node_modules/.bin/luamin --file work/ButtonHUD.extracted.lua > work/ButtonHUD.min.lua | ||
if [[ "$MINIFY" == "true" ]]; then | ||
echo "Minifying ... " | ||
# Using stdin pipe to avoid a bug in luamin complaining about "No such file: ``" | ||
echo "$WORK_DIR/ButtonHUD.extracted.lua" | $LUAMIN --file > $WORK_DIR/ButtonHUD.min.lua | ||
else | ||
cp work/ButtonHUD.extracted.lua work/ButtonHUD.min.lua | ||
cp $WORK_DIR/ButtonHUD.extracted.lua $WORK_DIR/ButtonHUD.min.lua | ||
fi | ||
|
||
# Wrap in AutoConf | ||
lua wrap.lua --handle-errors --output yaml --name "ButtonsHud - Dimencia and Archaegeo v$VERSION_NUMBER (Minified)" work/ButtonHUD.min.lua work/ButtonHUD.wrapped.conf --slots core:class=CoreUnit radar:class=RadarPVPUnit,select=manual antigrav:class=AntiGravityGeneratorUnit warpdrive:class=WarpDriveUnit gyro:class=GyroUnit weapon:class=WeaponUnit,select=manual dbHud:class=databank vBooster:class=VerticalBooster hover:class=Hovercraft door:class=DoorUnit,select=manual forcefield:class=ForceFieldUnit,select=manual atmofueltank:class=AtmoFuelContainer,select=manual spacefueltank:class=SpaceFuelContainer,select=manual rocketfueltank:class=RocketFuelContainer,select=manual | ||
SLOTS=( | ||
core:class=CoreUnit | ||
radar:class=RadarPVPUnit,select=manual | ||
antigrav:class=AntiGravityGeneratorUnit | ||
warpdrive:class=WarpDriveUnit | ||
gyro:class=GyroUnit | ||
weapon:class=WeaponUnit,select=manual | ||
dbHud:class=databank | ||
vBooster:class=VerticalBooster | ||
hover:class=Hovercraft | ||
door:class=DoorUnit,select=manual | ||
forcefield:class=ForceFieldUnit,select=manual | ||
atmofueltank:class=AtmoFuelContainer,select=manual | ||
spacefueltank:class=SpaceFuelContainer,select=manual | ||
rocketfueltank:class=RocketFuelContainer,select=manual | ||
) | ||
|
||
echo "Wrapping ..." | ||
lua ${ROOTDIR}/scripts/wrap.lua --handle-errors --output yaml \ | ||
--name "ButtonsHud - Dimencia and Archaegeo v$VERSION_NUMBER (Minified)" \ | ||
$WORK_DIR/ButtonHUD.min.lua $WORK_DIR/ButtonHUD.wrapped.conf \ | ||
--slots ${SLOTS[*]} | ||
|
||
# Re-insert the exports | ||
sed '/script={}/e cat work/ButtonHUD.exports' work/ButtonHUD.wrapped.conf > $CONF_DST | ||
sed "/script={}/e cat $WORK_DIR/ButtonHUD.exports" $WORK_DIR/ButtonHUD.wrapped.conf > $CONF_DST | ||
|
||
# Fix up minified L_TEXTs which requires a space after the comma | ||
sed -i -E 's/L_TEXT\(("[^"]*"),("[^"]*")\)/L_TEXT(\1, \2)/g' $CONF_DST | ||
|
||
rm work/* | ||
echo "$VERSION_NUMBER" > ${ROOTDIR}/ButtonHUD.conf.version | ||
|
||
echo "Compiled v$VERSION_NUMBER at ${CONF_DST}" | ||
|
||
rm $WORK_DIR/* |