Skip to content

Instantly share code, notes, and snippets.

@viggin543
Created September 24, 2022 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viggin543/da485ece89ccebe4004a0dcce8601df4 to your computer and use it in GitHub Desktop.
Save viggin543/da485ece89ccebe4004a0dcce8601df4 to your computer and use it in GitHub Desktop.
name: staging tests and build
on:
push:
branches: [ staging ]
jobs:
run-ci:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Run Type Check & Linters
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 14
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies (with cache)
uses: bahmutov/npm-install@HEAD
with:
install-command: yarn --frozen-lockfile
- name: Check types
run: yarn run type-check
- name: Check linting
run: yarn run lint
- name: Run tests
run: yarn test
- name: Caching Gatsby
id: gatsby-cache-build
uses: actions/cache@v2
with:
path: |
public
.cache
node_modules/.cache/babel-loader
node_modules/.cache/terser-webpack-plugin
key: ${{ runner.os }}-gatsby-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gatsby-build-
- name: build
run: yarn build
- name: Setup gcloud cli
uses: google-github-actions/setup-gcloud@v0
with:
version: '290.0.1'
project_id: gcp-project-id-foo
service_account_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
export_default_credentials: true
- name: deploy
run: |
echo "starting rsync"
cd public
gsutil -m rsync -r . gs://bucket-name-foo/
gcloud compute url-maps invalidate-cdn-cache url-map-name-foo --async --path="/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment