Skip to content

Instantly share code, notes, and snippets.

@hugoalmeidahh
Forked from diego3g/workflow.yml
Created June 23, 2021 02:40
Show Gist options
  • Save hugoalmeidahh/07b99cf7d39dec452291e5fa8292ac29 to your computer and use it in GitHub Desktop.
Save hugoalmeidahh/07b99cf7d39dec452291e5fa8292ac29 to your computer and use it in GitHub Desktop.
name: CI
on:
push:
branches: [master]
env:
BUCKET: reactdeploy.getomni.dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: yarn install
# - name: Run tests
# run: yarn test --watchAll false
- name: Build
run: yarn build
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Upload filed to bucket
run: gsutil -m rsync -R ./build gs://"$BUCKET"
- name: Allow public access
run: gsutil -m acl ch -R -u AllUsers:R gs://"$BUCKET"
# Set cache meta for static files
- name: Set Cache-Control
run: gsutil -m setmeta -h "Cache-Control:public, max-age=15768000" gs://"$BUCKET"/**/*.{png,svg,css,js}
# Set cache meta for index.html
- name: Set Cache-Control
run: gsutil setmeta -h "Cache-Control:no-cache, no-store" gs://"$BUCKET"/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment