Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR deployments #1841

Merged
merged 2 commits into from
Aug 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/pr-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR deployment
on:
pull_request:
types: [ opened, synchronize ]
jobs:
server:
name: server
runs-on: ubuntu-latest
steps:
- name: Kill any other PR deployments on this branch
uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout code
uses: actions/checkout@v1
- name: Use Node.js 10.15.3
uses: actions/setup-node@v1
with:
node-version: 10.15.3
Copy link
Contributor

Choose a reason for hiding this comment

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

don't suppose there's any way to use the .nvmrc file to synchronise this with the version we have there?

Copy link
Contributor Author

@jorgeazevedo jorgeazevedo Aug 21, 2020

Choose a reason for hiding this comment

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

Great point! It would be beneficial for all our actions. Unfortunately setup-node doesn't support it, though it looks like they're actively interested in it. Alternatively we can use nvm directly thought it does seem a little hacky. I'll pop a ticket in trello to investigate

- run: make build
- name: Boot server and run ngrok
run: |
npm install -g ngrok
NODE_ENV=production DISABLE_LOGGING_AND_METRICS=true node dist/frontend.server.js &
timeout 5h ngrok http 9000 -log=stdout | \
grep --line-buffered -o 'https://.*' | \
xargs -L1 -I{} -t \
curl -X POST -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} -d "{\"state\":\"success\", \"target_url\":\"{}\", \"context\":\"PR deployment\", \"description\":\"This PR is now live until `date -d "+5 hour" "+%a %H:%M"`. Click details to access it ->\"}"