diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5005500..91c3e18 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,8 +15,8 @@ jobs: id: set-env run: | echo "::set-output name=build_env::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo 'production'; else echo 'development'; fi)" - echo "::set-output name=path::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo '/'; elif [ '${{ github.ref }}' = 'refs/heads/testing' ]; then echo '/test'; else echo '/development'; fi)" - echo "::set-output name=page_root::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo '/CheemsBonkGame/'; elif [ '${{ github.ref }}' = 'refs/heads/testing' ]; then echo '/CheemsBonkGame/test/'; else echo '/CheemsBonkGame/development/'; fi)" + echo "::set-output name=path::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo 'app'; elif [ '${{ github.ref }}' = 'refs/heads/testing' ]; then echo 'test'; else echo 'development'; fi)" + echo "::set-output name=page_root::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo '/CheemsBonkGame/app/'; elif [ '${{ github.ref }}' = 'refs/heads/testing' ]; then echo '/CheemsBonkGame/test/'; else echo '/CheemsBonkGame/development/'; fi)" echo "::set-output name=build_prefix::$(if [ '${{ github.ref }}' = 'refs/heads/release' ]; then echo 'prod'; elif [ '${{ github.ref }}' = 'refs/heads/testing' ]; then echo 'test'; else echo 'dev'; fi)" - name: Checkout code uses: actions/checkout@v3 @@ -43,11 +43,6 @@ jobs: cp .pwa/favicon-$build_prefix.ico public/img/favicon.ico rm public/manifest.webmanifest cp .pwa/manifest-$build_prefix.webmanifest public/manifest.webmanifest - if [ "$build_prefix" = "prod" ]; then - cp .pwa/ngsw-config-prod.json ngsw-config.json - else - cp .pwa/ngsw-config-other.json ngsw-config.json - fi - name: Build the application env: @@ -77,18 +72,23 @@ jobs: env: path: ${{ steps.set-env.outputs.path }} run: | - target_dir="deploy-folder$path" + target_dir="deploy-folder/$path" mkdir -p "$target_dir" - find "$target_dir" -mindepth 1 -maxdepth 1 -exec rm -rf {} + + find "$target_dir" -mindepth 1 -not -name '.git' -exec rm -rf {} + - name: Copy New Files to Deploy Folder env: path: ${{ steps.set-env.outputs.path }} + build_env: ${{ steps.set-env.outputs.build_env }} run: | - target_dir="deploy-folder$path" + target_dir="deploy-folder/$path" mkdir -p "$target_dir" - cp -r dist/cheems-angular/browser/* "$target_dir/" - cp README.md .gitignore "$target_dir/" + cp -r dist/cheems-angular/browser/* "$target_dir" + cp README.md .gitignore "$target_dir" + if [ "$build_env" = "production" ]; then + cp .pwa/inde.html "deploy-folder/" + cp README.md .gitignore "deploy-folder/" + fi - name: Commit and Deploy to GitHub Pages working-directory: deploy-folder diff --git a/.pwa/index.html b/.pwa/index.html new file mode 100644 index 0000000..f1f8a5f --- /dev/null +++ b/.pwa/index.html @@ -0,0 +1,15 @@ + + + + + + + Cheems Bonk Game + + + +

If you are not redirected automatically, follow this link to the app.

+ + diff --git a/.pwa/manifest-prod.webmanifest b/.pwa/manifest-prod.webmanifest index 3fc1bab..2243dea 100644 --- a/.pwa/manifest-prod.webmanifest +++ b/.pwa/manifest-prod.webmanifest @@ -3,29 +3,29 @@ "short_name": "Cheems Bonk Game", "description": "A fun and interactive game featuring Cheems Bonk.", "display": "standalone", - "scope": "/CheemsBonkGame/", - "start_url": "/CheemsBonkGame/", + "scope": "/CheemsBonkGame/app/", + "start_url": "/CheemsBonkGame/app/", "icons": [ { - "src": "/CheemsBonkGame/img/icons/pwa/icon-72x72.png", + "src": "/CheemsBonkGame/app/img/icons/pwa/icon-72x72.png", "sizes": "72x72", "type": "image/png", "purpose": "maskable any" }, { - "src": "/CheemsBonkGame/img/icons/pwa/icon-144x144.png", + "src": "/CheemsBonkGame/app/img/icons/pwa/icon-144x144.png", "sizes": "144x144", "type": "image/png", "purpose": "maskable any" }, { - "src": "/CheemsBonkGame/img/icons/pwa/icon-192x192.png", + "src": "/CheemsBonkGame/app/img/icons/pwa/icon-192x192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable any" }, { - "src": "/CheemsBonkGame/img/icons/pwa/icon-512x512.png", + "src": "/CheemsBonkGame/app/img/icons/pwa/icon-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable any" diff --git a/.pwa/ngsw-config-other.json b/.pwa/ngsw-config-other.json deleted file mode 100644 index 1ac894a..0000000 --- a/.pwa/ngsw-config-other.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "./node_modules/@angular/service-worker/config/schema.json", - "index": "/index.html", - "assetGroups": [ - { - "name": "app", - "installMode": "prefetch", - "resources": { - "files": [ - "/favicon.ico", - "/index.csr.html", - "/index.html", - "/manifest.webmanifest", - "/*.css", - "/*.js" - ] - } - }, - { - "name": "assets", - "installMode": "lazy", - "updateMode": "prefetch", - "resources": { - "files": [ - "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2|txt|json|xml|csv|ico)" - ] - } - } - ] -} diff --git a/.pwa/ngsw-config-prod.json b/.pwa/ngsw-config-prod.json deleted file mode 100644 index 9d35792..0000000 --- a/.pwa/ngsw-config-prod.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "./node_modules/@angular/service-worker/config/schema.json", - "index": "/index.html", - "assetGroups": [ - { - "name": "app", - "installMode": "prefetch", - "resources": { - "files": [ - "/favicon.ico", - "/index.csr.html", - "/index.html", - "/manifest.webmanifest", - "/*.css", - "/*.js" - ], - "exclude": [ - "/test/**", - "/development/**" - ] - } - }, - { - "name": "assets", - "installMode": "lazy", - "updateMode": "prefetch", - "resources": { - "files": [ - "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2|txt|json|xml|csv|ico)" - ], - "exclude": [ - "/test/**", - "/development/**" - ] - } - } - ] -}