Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created July 2, 2020 16:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save diego3g/97a364469caacc0295e69d665253c447 to your computer and use it in GitHub Desktop.
Save diego3g/97a364469caacc0295e69d665253c447 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
@FabianoFPS
Copy link

GoogleCloudPlatform/github-actions/setup-gcloud has been deprecated. Please use google-github-actions/setup-gcloud
https://github.com/google-github-actions/setup-gcloud/blob/master/setup-gcloud/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment