Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ZGeek03 committed Mar 27, 2024
2 parents 2cb3ee1 + 4753cdf commit 63f5731
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/upload-display.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Display Publish

on:
workflow_dispatch:
push:
branches:
- main

jobs:
Build-And-Upload:
runs-on: macos-latest
env:
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 21.x
cache: npm
- name: Cache Setup
uses: actions/cache/restore@v4
with:
path: |
/Users/runner/Library/Caches/pip
~/.oci-cli-installed
key: ${{ runner.os }}-display-build
- name: Install
run: npm ci --include=dev --verbose --force
- name: Build
if: ${{ success() }}
run: npm run build
- name: Delete Contents
uses: oracle-actions/run-oci-cli-command@v1.1.1
with:
silent: false
command: os object bulk-delete --namespace-name ${{ vars.OCI_OBJECT_STORAGE_NAMESPACE }} --bucket-name ${{ vars.BUCKET_NAME }} --force
- name: Upload Contents
run: ./upload-display.sh ${{ vars.OCI_OBJECT_STORAGE_NAMESPACE }} ${{ vars.BUCKET_NAME }}
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import StopwatchTimer from './stopwatchTimer';
import TrackView from './trackView';
import LinearGauge from './linearGauge';

//const DATA_SOURCE = 'http://judas.arkinsolomon.net';
const DATA_SOURCE = window.location.hostname === 'localhost' ? 'http://localhost:8080' : 'http://judas.arkinsolomon.net';
//const DATA_SOURCE = 'https://judas.arkinsolomon.net';
const DATA_SOURCE = window.location.hostname === 'localhost' ? 'http://localhost:8080' : 'https://judas.arkinsolomon.net';

export default class App extends Component<Record<string, string>, AppState> {
private _socket?: Socket;
Expand Down
28 changes: 28 additions & 0 deletions upload-display.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -e

OCI_OBJECT_STORAGE_NAMESPACE=$1
ACCOUNTS_BUCKET_NAME=$2

find ./build -name ".DS_Store" -type f -delete

EXTENSIONS=$(find ./build -type f -name '*.*' | sed 's|.*\.||' | sort -u)
IFS=$'\n'

for EXT in $EXTENSIONS; do

if [ "$EXT" = "css" ]; then
MIME_TYPE="text/css"
elif [ "$EXT" = "js" ]; then
MIME_TYPE="application/javascript"
elif [ "$EXT" = "ico" ]; then
MIME_TYPE="image/x-icon"
else
TEST_FILE=$(find . -type f -iname "*.$EXT" | head -1)
MIME_TYPE=$(file -b --mime-type "$TEST_FILE")
fi

echo "Uploading all files with a .$EXT extension with a Mime-Type of $MIME_TYPE"
oci os object bulk-upload --src-dir ./build --namespace-name $OCI_OBJECT_STORAGE_NAMESPACE --bucket-name $ACCOUNTS_BUCKET_NAME --no-follow-symlinks --overwrite --include "*.$EXT" --parallel-upload-count 15 --content-type "$MIME_TYPE"
done

0 comments on commit 63f5731

Please sign in to comment.