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

Adds a server, and deploys to staging #388

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletions .github/workflows/DeployStaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Website To Staging

on:
push:
branches: [v2]

jobs:
build:
runs-on: ubuntu-latest

steps:
# Check out, and set up the node/ruby infra
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '13.x'

# Build v2
- name: Build website v2
run: |
yarn install
yarn bootstrap
yarn build
yarn build-site

# Move the files to the new app
- run: rm -rf serve/public
- name: Move V2 public to serve dir
run: cp packages/typescriptlang-org/public serve

- name: Build serve server
run: |
cd serve
npm i

# Deploy _just_ the serve server
- uses: azure/webapps-deploy@v1
with:
creds: ${{ secrets.AZURE_STAGING_PUBLISHING_PROFILE }}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
},
"dependencies": {
"serve-handler": "^6.1.2"
}
}
5 changes: 5 additions & 0 deletions serve/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Azure App

For an App Service App we need an app to host our static content.

Here is one, it doesn't do much but hosts files inside the public directory.
13 changes: 13 additions & 0 deletions serve/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const handler = require('serve-handler')
const http = require('http')

const server = http.createServer((request, response) => {
// You pass two more arguments for config and middleware
// More details here: https://github.com/zeit/serve-handler#options
return handler(request, response, { public: 'public' })
})

const port = process.env.PORT || 3000
server.listen(port, () => {
console.log('Running at http://localhost:' + port)
})
99 changes: 99 additions & 0 deletions serve/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions serve/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"scripts": {
"start": "node index.js"
},
"dependencies": {
"serve-handler": "^6.1.2"
}
}
3 changes: 3 additions & 0 deletions serve/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<html>
<p>This is a blank file which is overwritten during a deploy</p>
</html>