Skip to content

HPO-WEB Static Deployment #33

HPO-WEB Static Deployment

HPO-WEB Static Deployment #33

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: HPO-WEB Static Deployment
# Controls when the workflow will run
on: workflow_dispatch
env:
GCLOUD_BUCKET: ${{ secrets.GCLOUD_PUBLIC_BUCKET }}
jobs:
load:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}'
- name: Setup Google Cloud CLI
uses: 'google-github-actions/setup-gcloud@v1'
- name: Configure Node
uses: actions/setup-node@v3
with:
node-version: 16.10.0
cache: 'npm'
- name: Lint, Test, Build
run: |
npm install
npm run lint
npm run testci
npm run buildProd --if-present
- name: Set Project Version
run: echo "PROJECT_VERSION=$(cat package.json | jq -r '.version')" >> "$GITHUB_ENV"
- name: Set Github Hash
run: echo "GIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Deploy to GCS
run: |
gsutil -m cp -r dist/* "$GCLOUD_BUCKET/hpo-web-$PROJECT_VERSION-$GIT_HASH/"
gsutil -m rm -f "$GCLOUD_BUCKET/*" || true
gsutil -m rm -rf "$GCLOUD_BUCKET/assets/" || true
gsutil -m cp -r "$GCLOUD_BUCKET/hpo-web-$PROJECT_VERSION-$GIT_HASH/*" "$GCLOUD_BUCKET/"