Skip to content

Commit

Permalink
Add workflow, readme and license
Browse files Browse the repository at this point in the history
  • Loading branch information
Dove6 committed Oct 12, 2022
1 parent fec8fc5 commit c92d93b
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 0 deletions.
159 changes: 159 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Release

on:
push:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
outputs:
is-release: ${{ steps.check-tag.outputs.match }}
midi-filenames: ${{ steps.out-filenames.outputs.midi }}
env:
JOB_FILE: ./job.json
steps:
# source: https://stackoverflow.com/a/58869470
- name: Check tag
id: check-tag
run: |
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9] ]]; then
echo "match=true" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
- name: Extract MIDI filenames from job.json
id: out-filenames
run: |
midi_filenames=$(jq -c 'reduce ([.[].out] | flatten) as $x ([]; . + $x) | map(select(ascii_downcase | endswith(".mid") or endswith(".midi")))' "$JOB_FILE")
echo "midi=$midi_filenames" >> $GITHUB_OUTPUT
- run: |
sudo snap install musescore
sudo snap connect musescore:cups-control
- name: Run conversion job
run: xvfb-run -a musescore.mscore -j "$JOB_FILE"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
*.flac
*.mid
*.midi
*.mp3
*.ogg
*.pdf
*.png
*.svg
*.wav
build-chiptune:
needs: [ build ]
runs-on: ubuntu-latest
container: scottyhardy/docker-wine
env:
DISPLAY: ':49'
steps:
- run: |
wget https://meme.institute/gxscc/gxscc.zip
unzip ./gxscc.zip
rm ./gxscc.zip
- run: |
sudo apt-get update
sudo apt-get install -y x11-utils xdotool jq
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
# source: https://unix.stackexchange.com/a/259403
- name: Generate chiptune version from MIDI
run: |
while_xdotool() {
# source: https://gist.github.com/shvchk/ecfcb9c43050a08cb55ece9efb935da9
T0=$(date +%s)
while [ $(( `date +%s` - T0 )) -lt 60 ]; do
set +e
errout=$(xdotool "$@" 2>&1 1>/dev/null)
errcode=$?
[ $errcode -eq 0 ] || echo "$errout"
set -e
case "$errout" in
*BadWindow*)
;;
*)
[ $errcode -eq 0 ] || break
;;
esac
sleep 0.1
done
}
until_xdotool() {
# source: https://gist.github.com/shvchk/ecfcb9c43050a08cb55ece9efb935da9
T0=$(date +%s)
while [ $(( `date +%s` - T0 )) -lt 60 ]; do
xdotool "$@" >/dev/null && break
sleep 0.1
done
}
sudo chown -R "$(whoami)" ~
echo 'pcm.!default {\n type plug\n slave.pcm "null"\n}' > /etc/asound.conf
Xvfb $DISPLAY &
echo "Waiting for display $DISPLAY to become available"
until xwininfo -root; do
sleep 1
done
midi_filenames_json='${{ needs.build.outputs.midi-filenames }}'
echo "$midi_filenames_json" | jq -r '.[]' | while IFS= read -r input_filename; do
echo "Generating chiptune from $input_filename"
if [ ! -e "$input_filename" ]; then
echo "File $input_filename not found"
false
fi
wine gxscc.exe "$input_filename" &
echo "Waiting for initial prompt"
until_xdotool search --onlyvisible --name "^GXSCC$" key Return
echo "Waiting for main window init"
until_xdotool search --onlyvisible --name "^GASHISOFT GXSCC" windowmove --sync 0 0
xdotool mousemove --sync 310 50 click 1
echo "Waiting for Authoring prompt"
until_xdotool search --onlyvisible --name "^GXSCC$" key Return
echo "Waiting for Authoring end"
while_xdotool search --onlyvisible --name "^GXSCC$"
until xdotool search --onlyvisible --name "^GXSCC$"; do
xdotool mousemove --sync 310 50 click 1
sleep 1
done
until_xdotool search --onlyvisible --name "^GXSCC$" key Escape
echo "Closing windows"
xdotool mousemove --sync 625 10 click 1
while_xdotool search --onlyvisible --name "^GASHISOFT GXSCC"
sleep 1
done
find -iname '*.mwav' | sed 'p;s/\.mwav$/\.WAV/i' | xargs -rd '\n' -n 2 mv
ps auxww | grep "Xvfb $DISPLAY" | grep -v 'grep' | awk '{print $2}' | xargs -r kill
- name: Update artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: ./*.[Ww][Aa][Vv]
# source: https://stackoverflow.com/a/70716837
release:
runs-on: ubuntu-latest
needs: [ build, build-chiptune ]
if: needs.build.outputs.is-release == 'true'
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: artifacts
- uses: actions/checkout@v3
with:
path: repository
- name: Create a release
uses: softprops/action-gh-release@v1
id: create-release
with:
body_path: repository/CHANGELOG.md
files: artifacts/*
fail_on_unmatched_files: true
Empty file added CHANGELOG.md
Empty file.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2019 Dawid Sygocki

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Rex and the Wizards: pojedynek

![GitHub Workflow status](https://img.shields.io/github/workflow/status/soundtrack-rexcreation/Wizards_pojedynek/workflow)
![Total download count](https://img.shields.io/github/downloads/soundtrack-rexcreation/Wizards_pojedynek/total)
![License](https://img.shields.io/github/license/soundtrack-rexcreation/Wizards_pojedynek)
![Latest release version](https://img.shields.io/github/v/release/soundtrack-rexcreation/Wizards_pojedynek)
![Latest release date](https://img.shields.io/github/release-date/soundtrack-rexcreation/Wizards_pojedynek)

*Read this in other languages: [🇵🇱 polski](README.pl.md).*

## Download

Check [the latest release](https://github.com/soundtrack-rexcreation/Wizards_pojedynek/releases/latest) for audio files and sheet notes!

## Original details

- Official title: Fowls of Chaos
- Composer: [Bartłomiej Brosz](https://www.linkedin.com/in/bartek-brosz-81b1843)
- Source game: *Rex and the Wizards* by [Aidem Media](https://boombit.com/)
- Filename: pojedynek.wav

### Availability online

- Spotify: https://open.spotify.com/track/1cqAleCZ8DcMDZuukcVtb7?si=eae973e28ae04cd0
- Apple Music: https://music.apple.com/gb/album/fowls-of-chaos/1511913253?i=1511913258
- deezer: https://deezer.page.link/kkfBbz3tVYyo6mvDA
- YouTube: https://www.youtube.com/watch?v=7pdSMtu24Vc
27 changes: 27 additions & 0 deletions README.pl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Reksio i Czarodzieje: pojedynek

![Status GitHub Workflow](https://img.shields.io/github/workflow/status/soundtrack-rexcreation/Wizards_pojedynek/workflow)
![Łączna liczba pobrań](https://img.shields.io/github/downloads/soundtrack-rexcreation/Wizards_pojedynek/total?label=pobrania)
![Licencja](https://img.shields.io/github/license/soundtrack-rexcreation/Wizards_pojedynek?label=licencja)
![Ostatni numer wydania](https://img.shields.io/github/v/release/soundtrack-rexcreation/Wizards_pojedynek?label=wydanie)
![Ostatnia data wydania](https://img.shields.io/github/release-date/soundtrack-rexcreation/Wizards_pojedynek?label=data%20wydania)

*Read this in other languages: [🇺🇸 English](README.md).*

## Pobieranie

Pliki audio oraz nuty dostępne są na stronie [najświeższego wydania](https://github.com/soundtrack-rexcreation/Wizards_pojedynek/releases/latest).

## Dane oryginału

- Oficjalny tytuł: Fowls of Chaos
- Kompozytor: [Bartłomiej Brosz](https://www.linkedin.com/in/bartek-brosz-81b1843)
- Gra źródłowa: *Reksio i Czarodzieje* od [Aidem Media](https://boombit.com/)
- Nazwa pliku: pojedynek.wav

### Dostępność online

- Spotify: https://open.spotify.com/track/1cqAleCZ8DcMDZuukcVtb7?si=eae973e28ae04cd0
- Apple Music: https://music.apple.com/gb/album/fowls-of-chaos/1511913253?i=1511913258
- deezer: https://deezer.page.link/kkfBbz3tVYyo6mvDA
- YouTube: https://www.youtube.com/watch?v=7pdSMtu24Vc
10 changes: 10 additions & 0 deletions job.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"in": "pojedynek.mscz",
"out": [
"pojedynek.pdf",
"pojedynek.flac",
"pojedynek.mid"
]
}
]

0 comments on commit c92d93b

Please sign in to comment.