-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/HEEV/supermileage-display-web
- Loading branch information
Showing
3 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |