-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1500 from EnterpriseDB/test/josh/auto-deploy-netl…
…ify-draft Label-triggered draft deploys Former-commit-id: 2d480cf
- Loading branch information
Showing
9 changed files
with
629 additions
and
268 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Deploy branch draft on Netlify | ||
on: | ||
pull_request: | ||
types: [labeled, opened, synchronize] | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-deploy: | ||
if: | | ||
(github.event.action == 'labeled' && github.event.label.name == 'deploy') || | ||
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'deploy')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: compose a name for the build environment | ||
run: echo "BUILD_ENV_NAME=pr-${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 # fetch whole repo so git-restore-mtime can work | ||
|
||
- name: Adjust file watchers limit | ||
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
|
||
# ref: https://github.com/actions/cache/blob/main/examples.md#node---yarn | ||
- name: Get yarn cache directory | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Checking Yarn cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Yarn install | ||
run: npx yarn install --immutable | ||
env: | ||
NODE_ENV: ${{ secrets.NODE_ENV }} | ||
|
||
- name: Checking Gatsby cache | ||
id: gatsby-cache-build | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
public | ||
.cache | ||
key: ${{ runner.os }}-gatsby-build-draft-${{ github.head_ref }} | ||
|
||
- name: Fix mtimes | ||
run: yarn fix-mtimes --force | ||
|
||
- name: Gatsby build | ||
run: yarn build | ||
env: | ||
APP_ENV: staging | ||
NODE_ENV: ${{ secrets.NODE_ENV }} | ||
NODE_OPTIONS: --max-old-space-size=4096 | ||
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | ||
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | ||
ALGOLIA_INDEX_NAME: edb-docs-staging | ||
INDEX_ON_BUILD: false | ||
|
||
- name: Deploy to Netlify | ||
id: netlify-deploy | ||
uses: nwtgck/[email protected] | ||
with: | ||
publish-dir: './public' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
deploy-message: ${{ github.event.pull_request.title }} | ||
enable-commit-comment: false | ||
github-deployment-environment: ${{ env.BUILD_ENV_NAME }} | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEVELOP_SITE_ID }} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,3 +285,4 @@ Option 2: on GitHub | |
|
||
1. Edit a file on GitHub. | ||
2. Submit changes as a PR on a new branch. | ||
|
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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