feat: Auto-release on default branch build (#4) (#467) #275
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
name: Generate SoH Archive | |
on: | |
push: | |
branches: [ "Custom-Music-2.0" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get short commit hash | |
id: vars | |
run: echo "short_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" | |
- name: Generate SoH archive | |
run: | | |
cd data | |
find . -type f -name '*.ootrs' | while read filename; do unzip -o -d "./Music/`basename -s .ootrs "$filename"`" "$filename"; done; | |
wget https://github.com/leggettc18/SequenceOTRizer/releases/download/v0.4/SequenceOTRizer-0.2-Linux.tar.gz | |
tar -xzvf SequenceOTRizer-0.2-Linux.tar.gz | |
./SequenceOTRizer --seq-path Music --otr-name daruniasjoy | |
- name: Upload generated daruniasjoy.otr | |
uses: actions/upload-artifact@v4 | |
with: | |
name: daruniasjoy.otr | |
path: data/mods | |
# If this repo gets reverted to a previous release or if this workflow ever gets re-ran, creating a new release would break the build | |
# If you really want to regenerate the release, you'll have to manually delete the release | |
- name: Check for existing release | |
run: | | |
releases=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/releases) | |
if echo "$releases" | grep -q "tag_name\": \"main-$short_hash"; then | |
echo "Release already exists" | |
exit 1 | |
fi | |
- name: Create GitHub Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: Build-${{ env.short_hash }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: data/mods/daruniasjoy.otr | |
tag_name: Build-${{ env.short_hash }} |