Created
July 2, 2020 16:03
-
-
Save diego3g/97a364469caacc0295e69d665253c447 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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
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