第一步前往Cloud Storage, 點擊 +CREATE BUCKET, 在 Choose where to store your data 的區塊, Location type 有三種
multi-region
dual-region
region
這是地理位置與高可用性的相關設定,越後面的設定成本越便宜,但是可用性也越低。 即使如此 google 仍保証了 SLA: 99.95% 的高可用性。
接下來是 Choose a default storage class for your data 的區塊,有
Standard
Nearline
Coldline
Archive
等四種不同的設定, 與檔案的使用頻率有關,對於網站來說建議使用 Standard 。 收費可以參考下表
Standard
Nearline
Coldline
Archive
Storage(per GB-Month)
$0.026
$0.01
$0.007
$0.004
retrieval(per GB-Month)
Free
$0.01
$0.02
$0.05
Class A Operations(per 1000ops)
$0.005
$0.01
$0.01
$0.05
Class B Operations(per 1000 ops)
$0.0004
$0.001
$0.005
$0.05
SLA
99.95%
99.9%
99.9%
99.9%
接下來是 Choose how to control access to objects 的設定, 不要勾選 Enforce public access prevention on this bucket, Access control 選擇 Uniform , 這裡的設定是為了避免從 internet 存取 bucket 的資料, 但是我們的目的是放置靜態網站的資料,所以不需設定。
再來是 Choose how to protect object data 這是保護資料的策略,有版本(versioning)與備份(retention)兩種策略, 我們不需要所以選擇 None
按下 Create 以建立 Bucket, 接下來為了讓 web 存取我們選擇 more action(3 個點的 Icon ) > Edit Access New Principals > 選擇 allUsers > Storage Object Viewer. 接下來可以上傳你的靜態網站的資源了,這裡我們多作一個設定,通常我們要指定網站的首頁為何, 約定成俗是 index.html,一樣 more action(3 個點的 Icon ) > edit website configuration 將 Index (main) page suffix 設定為 index.html(記得 bucket 裡要有這個檔)
deploy-job:# This job runs in the deploy stage. stage:deploy# It only runs when *both* jobs in the test stage complete successfully. image:google/cloud-sdk needs: -job:build-job artifacts:true script: # - gcloud auth list # Show the ACTIVE ACCOUNT * -gsutilrsync-Rbuildgs://your_bucket_name -echo"Application successfully deployed."
-name:SonarCloudScan uses:marsen/[email protected] with: # The key of the SonarQube project sonarProjectKey:Marsen.NetCore.Dojo # The name of the SonarQube project sonarProjectName:Marsen.NetCore.Dojo # The name of the SonarQube Organization sonarOrganization:marsen-github # Optional extra command arguments the the SonarScanner 'begin' command sonarBeginArguments:/d:sonar.cs.opencover.reportsPaths="./test/*/TestResults/*/coverage.opencover.xml" # Optional. Set to 1 or true to not run 'dotnet test' command # dotnetDisableTests: true dotnetTestArguments:Marsen.NetCore.Dojo.Integration.Test.sln--loggertrx-p:CoverletOutputFormat="opencover"--collect:"XPlatCodeCoverage"--DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover dotnetBuildArguments:Marsen.NetCore.Dojo.sln
// Import the functions you need from the SDKs you need import { initializeApp } from"firebase/app"; import { getAnalytics } from"firebase/analytics"; // TODO: Add SDKs for Firebase products that you want to use // https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration // For Firebase JS SDK v7.20.0 and later, measurementId is optional const firebaseConfig = { apiKey: "A****************", authDomain: "******.firebaseapp.com", projectId: "******", storageBucket: "******.appspot.com", messagingSenderId: "******", appId: "1:******:web:******", measurementId: "G-*********", };
// If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
// If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
// If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals(); });
//return value functionfoo1(a, b) { return a + b; } // arrow function letfoo2 = (a, b) => { return a + b; }; // skip { } and return letfoo3 = (a, b) => a + b;
functionfoo4(a, b) { return { sum: a + b }; } // arrow function letfoo5 = (a, b) => { return { sum: a + b }; }; // add () so you can skip { } and return letfoo6 = (a, b) => ({ sum: a + b });