diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..00cf17e --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,96 @@ +name: Build Release + +on: + push: + tags: + - 'v*.*' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + permissions: + contents: write + pull-requests: read + env: + RELEASE_ZIP_FILENAME: ${{ github.event.repository.name }}-${{ github.ref_name }}.zip + RELEASE_TAR_GZ_FILENAME: ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Set up Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: '18.19.x' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: "Build Changelog" + id: build_changelog + uses: requarks/changelog-action@4a2c34a1a8fcfa9e48e61960aad0affc15066393 + with: + tag: ${{ github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} + writeToFile: false + includeInvalidCommits: true + + - name: Create Zip Archive + run: | + echo "::start:: Creating zip archive..." + (cd dist && \ + zip \ + -r ../$RELEASE_ZIP_FILENAME . \ + -x "node_modules/*" "*/node_modules/*" \ + $(test -f ../.releaseignore && echo "-x@../.releaseignore")\ + ) + echo "::end:: Created zip archive." + + - name: Create Tar Gz Archive + run: | + echo "::start:: Creating tar.gz archive..." + (cd dist && \ + tar \ + -czv -f ../$RELEASE_TAR_GZ_FILENAME \ + --exclude "node_modules/*" \ + --exclude "*/node_modules/*" \ + $(test -f ../.releaseignore && echo "--exclude-from ../.releaseignore") \ + . + ) + echo "::end:: Created tar.gz archive." + + - name: "Generate build number" + id: generate_build_number + uses: onyxmueller/build-tag-number@4a0c81c9af350d967032d49204c83c38e6b0c8e4 + with: + token: ${{secrets.github_token}} + + - name: "Create Kiosk Pro version file" + id: create_kiosk_pro_version_file + uses: IMAGINARY/kiosk-pro-version-file-action@1f8f5671ccc7617998e5468aff5e89854bf10e3e + with: + version: ${{ steps.generate_build_number.outputs.build_number }} + zip: ${{ env.RELEASE_ZIP_FILENAME }} + clear-previous-content: 'true' + + - name: Create the release + uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 + with: + files: | + ${{ env.RELEASE_ZIP_FILENAME }} + ${{ env.RELEASE_TAR_GZ_FILENAME }} + ${{ steps.create_kiosk_pro_version_file.outputs.filepath }} + body: ${{ steps.build_changelog.outputs.changes }} diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..72cab97 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,94 @@ +name: Deploy to GitHub Pages + +on: + # Run on pushes to the default branch + push: + branches: + - main + + # ... Also run manually + workflow_dispatch: + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +# Default to bash +defaults: + run: + shell: bash + +jobs: + # Build job + build: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + permissions: + contents: write + pull-requests: read + env: + INPUT_PATH: "dist/" + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Set up Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 + with: + node-version: '18.19.x' + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Fix permissions + run: | + chmod -c -R +rX "$INPUT_PATH" | while read line; do + echo "::warning title=Invalid file permissions automatically fixed::$line" + done + + - name: Archive artifact + shell: sh + run: | + echo ::group::Archive artifact + tar \ + --dereference --hard-dereference \ + --directory "$INPUT_PATH" \ + -cvf "$RUNNER_TEMP/artifact.tar" \ + --exclude=.git \ + --exclude=.github \ + --exclude=*/node_modules/* \ + --exclude=node_modules/* \ + $(test -f ../.releaseignore && echo "--exclude-from=../.releaseignore") \ + . + echo ::endgroup:: + env: + INPUT_PATH: ${{ env.INPUT_PATH }} + + - name: Upload artifact + id: upload-artifact + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 + with: + name: github-pages + path: ${{ runner.temp }}/artifact.tar + retention-days: 1 + if-no-files-found: error + + deploy: + needs: build + runs-on: ubuntu-22.04 + timeout-minutes: 10 + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9897feb --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/dist +/work +node_modules +!**/.gitkeep diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/dm-bonn-gradient-descent.iml b/.idea/dm-bonn-gradient-descent.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/dm-bonn-gradient-descent.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d319bab --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 516d4f1..87fbae1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # futurium-suitcase-gradient-descent + Gradient Descent as a suitcase exhibit for Futurium + +## Building + +Requires Node.js (v18.19 or greater) and npm. + +Run the following from the root directory of the project: + +```bash +npm install +npm run build +``` + +This will create a `dist` directory with the compiled exhibit. This directory can be served by any web server. + +## Credits + +This adaptation was developed by Eric Londaits for Imaginary gGmbH. + +## License + +Code licensed under the MIT License. See [LICENSE](LICENSE) for details. + +Copyright 2024 Imaginary gGmbH. + diff --git a/extras/.gitkeep b/extras/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/extras/config.json b/extras/config.json new file mode 100644 index 0000000..1886ee6 --- /dev/null +++ b/extras/config.json @@ -0,0 +1,19 @@ +{ + "defaultLanguage": "de", + "languages": ["de", "en"], + "useGamepads": true, + "useScreenControls": false, + "useKeyboardControls": true, + "maxPlayers": 2, + "maxTime": 100, + "maxProbes": 10, + "maxDepthTilt": 4, + "continuousGame": false, + "fullScreenButton": false, + "languageButton": true, + "debugControls": false, + "showBotTypeTips": true, + "showDemo": true, + "demoDuration": 30000, + "debugLog": false +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4a1ed61 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "futurium-suitcase-gradient-descent", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "futurium-suitcase-gradient-descent", + "version": "1.0.0", + "dependencies": { + "degit": "^2.8.4" + } + }, + "node_modules/degit": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/degit/-/degit-2.8.4.tgz", + "integrity": "sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==", + "bin": { + "degit": "degit" + }, + "engines": { + "node": ">=8.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6c8272c --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "futurium-suitcase-gradient-descent", + "version": "1.0.0", + "description": "", + "main": "index.js", + "dependencies": { + "degit": "^2.8.4" + }, + "scripts": { + "build": "rm -rf ./dist && degit github:IMAGINARY/gradient-descent#v1.8.3 --force dist && cp -R ./extras/. ./dist/. && cd ./dist/src && npm install && npm run build && cd .. && cd .." + }, + "repository": { + "type": "git", + "url": "https://github.com/IMAGINARY/futurium-suitcase-gradient-descent.git" + }, + "private": true +}