How we deploy every pull request to a seperate domain.

Here is your deployed pull request (source: https://unsplash.com/photos/3syTDiVAc7w)

But why?

  1. We checkout the branch on our local development machines
  2. We build the project
  3. We test the build for errors
  4. Finally we review the code itself

What do you need?

Let’s set it up!

Tokens

GitHub token scopes

CI Server

The Script

#!/bin/bash# deploy to surge.sh
npx surge --project ${BUILD_DIR} --domain ${TRAVIS_PULL_REQUEST}.${SURGE_SUBDOMAIN}.surge.sh
# comment url to pull request
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST -d "{\"body\": \"❤️ I have deployed this pull-request for you: \nhttp://${TRAVIS_PULL_REQUEST}.${SURGE_SUBDOMAIN}.surge.sh\"}" "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments"
travis ci environment variables

--

--

--

https://adrianjost.dev

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Premium Launch Happens Today at 18:00 UTC!

World Adventures: How I Learned all about Slippy Tile Maps

Building my own (recursive descent) SQL parser in Python

Four ways of using Feature Upvote

CS371p Spring 2021: Week 2

Is Stack Overflow Too Mean?

Drink Tea with Envoy Proxy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adrian Jost

Adrian Jost

https://adrianjost.dev

More from Medium

Time zones and Flux — Part I

Deepin system startup process and introduction of key components [2]

Creating a RESTful Web Service With Spring Boot — Part 5

Requiring an event before each iteration of a “for” loop (using async functions and promise…

overview image of the final code solution