Skip to content

Commit

Permalink
feat: First working version.
Browse files Browse the repository at this point in the history
  • Loading branch information
elondaits committed Oct 21, 2024
1 parent 0cf8b75 commit a3b0c55
Show file tree
Hide file tree
Showing 13 changed files with 330 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
94 changes: 94 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist
/work
node_modules
!**/.gitkeep
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/dm-bonn-gradient-descent.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Empty file added extras/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions extras/config.json
Original file line number Diff line number Diff line change
@@ -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
}
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit a3b0c55

Please sign in to comment.