Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Deploy to vercel (#308)
Browse files Browse the repository at this point in the history
* Deploy to vercel

* Fix dist path
  • Loading branch information
fewensa authored Feb 25, 2022
1 parent 58a4d1a commit 951b6a9
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 64 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy develop

on:
pull_request:

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2
with:
repository: itering/actions
path: .github/actions
persist-credentials: false
ssh-key: "${{ secrets.ITERING_ACTIONS_DEPLOY_KEY }}"

- uses: ./.github/actions/smart-vercel
name: Deploy to Vercel
id: smart-vercel
with:
vercel_token: ${{ secrets.VERCEL_TOKEN }}
vercel_group: itering
preview_output: true
dist_path: packages/apps/build

- uses: marocchino/sticky-pull-request-comment@v2
with:
append: true
message: ${{ steps.smart-vercel.outputs.PREVIEW_OUTPUT }}

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: darwinia-apps
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/14985020?s=48&v=4
SLACK_MESSAGE: '${{ steps.smart-vercel.outputs.PREVIEW_LINK }}'
SLACK_TITLE: Preview
SLACK_USERNAME: Vercel
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
41 changes: 41 additions & 0 deletions .github/workflows/deploy-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy production

on:
push:
tags:
- 'v*'

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2
with:
repository: itering/actions
path: .github/actions
persist-credentials: false
ssh-key: "${{ secrets.ITERING_ACTIONS_DEPLOY_KEY }}"

- uses: ./.github/actions/smart-vercel
name: Deploy to Vercel
id: smart-vercel
with:
vercel_token: ${{ secrets.VERCEL_TOKEN }}
vercel_group: itering
preview_output: true
prod_mode: true
dist_path: packages/apps/build

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: darwinia-apps
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/14985020?s=48&v=4
SLACK_MESSAGE: '${{ steps.smart-vercel.outputs.PREVIEW_LINK }}'
SLACK_TITLE: Preview
SLACK_USERNAME: Vercel
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
39 changes: 39 additions & 0 deletions .github/workflows/deploy-stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy staging

on:
push:
branches: [master]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2
with:
repository: itering/actions
path: .github/actions
persist-credentials: false
ssh-key: "${{ secrets.ITERING_ACTIONS_DEPLOY_KEY }}"

- uses: ./.github/actions/smart-vercel
name: Deploy to Vercel
id: smart-vercel
with:
vercel_token: ${{ secrets.VERCEL_TOKEN }}
vercel_group: itering
preview_output: true
dist_path: packages/apps/build

- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: darwinia-apps
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/14985020?s=48&v=4
SLACK_MESSAGE: '${{ steps.smart-vercel.outputs.PREVIEW_LINK }}'
SLACK_TITLE: Preview
SLACK_USERNAME: Vercel
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
31 changes: 0 additions & 31 deletions .github/workflows/production.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/staging.yml

This file was deleted.

25 changes: 25 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "origin-when-cross-origin"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=2592000"
}
]
}
]
}

0 comments on commit 951b6a9

Please sign in to comment.