Skip to content

Commit

Permalink
ci: deploy to netlify using github actions (#1818)
Browse files Browse the repository at this point in the history
- deploy previews via github actions in 4 minutes instead of 8
- production build as well
  • Loading branch information
acao authored Mar 29, 2021
1 parent 32c8593 commit 3e2c9c8
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# .github/workflows/netlify.yml
name: Netlify Deploy Preview
on:
push:
paths-ignore:
- '**.md'
- 'examples'
- '!examples/monaco-graphql-webpack'

jobs:
build:
name: "Build & Deploy"
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Yarn Install
uses: bahmutov/npm-install@v1
# ( Build to ./dist or other directory... )
- name: Build
run: yarn build

- name: Build Bundles
run: yarn build-bundles

- name: Build Typedoc
run: yarn build-docs

- name: Deploy Dev to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './packages/graphiql/'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy Preview: ${{ github.event.pull_request.title }}. Use `/dev` for react debugging"
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
functions-dir: functions
github-deployment-environment: "Deploy Preview"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
timeout-minutes: 1
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# .github/workflows/netlify.yml
name: Netlify Production Deploy
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'examples'
- '!examples/monaco-graphql-webpack'

jobs:
deploy:
name: "Build & Deploy Production Demo & API Docs"
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Yarn Install
uses: bahmutov/npm-install@v1
# ( Build to ./dist or other directory... )

- name: Build
run: yarn build

- name: Build Bundles
run: yarn build-bundles

- name: Build Typedoc
run: yarn build-docs

- name: Deploy Production Demo & Typedoc to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './packages/graphiql/'
production-branch: main
production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "GraphiQL 1 Demo"
functions-dir: functions
github-deployment-environment: "GraphiQL 1 Demo"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
timeout-minutes: 1
3 changes: 2 additions & 1 deletion .github/workflows/push-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
- name: Yarn Install
uses: bahmutov/npm-install@v1

- run: yarn test --coverage
- name: Run Unit Tests
run: yarn test --coverage

- name: Codecov
uses: codecov/codecov-action@v1
Expand Down

2 comments on commit 3e2c9c8

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.