diff --git a/.gitea/workflows/push-banks.yml b/.gitea/workflows/push-banks.yml new file mode 100644 index 0000000..6a863de --- /dev/null +++ b/.gitea/workflows/push-banks.yml @@ -0,0 +1,54 @@ +name: Push FMOD Banks to Unity Repo + +on: + workflow_dispatch: + workflow_call: + +jobs: + push-banks: + runs-on: linux-mint + steps: + - name: Download Built Banks + uses: actions/download-artifact@v4 + with: + name: fmod-banks + path: ./downloaded-banks + + - name: Clone, Update Banks and Push Branch + env: + UNITY_SSH_KEY: ${{ secrets.TESTFMODPIPELINE }} + GITEA_HOST: https://git.hbrsgamedev.team + UNITY_SSH_URL: git@https://git.hbrsgamedev.team:sdaehn2s/Team-A-dream-traveler-unity-test.git + run: | + set -e + + mkdir -p ~/.ssh + chmod 700 ~/.ssh + printf "%s\n" "$UNITY_SSH_KEY" > ~/.ssh/id_fmod + chmod 600 ~/.ssh/id_fmod + ssh-keyscan -H "$GITEA_HOST" >> ~/.ssh/known_hosts + + export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_fmod -o IdentitiesOnly=yes" + + rm -rf ./unity-repo + git clone "$UNITY_SSH_URL" ./unity-repo + cd ./unity-repo + + git config user.name "fmod-pipeline-bot" + git config user.email "fmod-bot@h-brs.local" + + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) + BRANCH_NAME="fmod/banks-${{ github.run_number }}-${SHORT_SHA}" + git checkout -b "$BRANCH_NAME" + + TARGET_DIR="Assets/StreamingAssets/FMOD" + mkdir -p "$TARGET_DIR" + cp -r ../downloaded-banks/* "$TARGET_DIR/" + + git add "$TARGET_DIR" + if git diff --cached --quiet; then + echo "Keine Änderungen an den .bank-Dateien – kein Commit nötig." + else + git commit -m "chore(fmod): update banks from run #${{ github.run_number }} (${SHORT_SHA})" + git push -u origin "$BRANCH_NAME" + fi \ No newline at end of file