Skip to content

Commit 31373d8

Browse files
Merge 90e6310 into f94e433
2 parents f94e433 + 90e6310 commit 31373d8

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/docs-preview.yaml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Docs preview
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
actions: none
10+
checks: none
11+
contents: read
12+
deployments: none
13+
issues: none
14+
packages: none
15+
pull-requests: write
16+
repository-projects: none
17+
security-events: none
18+
statuses: none
19+
20+
jobs:
21+
preview:
22+
name: Docs preview
23+
runs-on: ubuntu-20.04
24+
steps:
25+
- name: Cancel Previous Runs
26+
uses: styfle/[email protected]
27+
28+
- name: Checkout m
29+
uses: actions/checkout@v2
30+
with:
31+
repository: cdr/m
32+
ref: refs/heads/master
33+
token: ${{ secrets.GH_ACCESS_TOKEN }}
34+
submodules: true
35+
fetch-depth: 0
36+
37+
- name: Install Node.js
38+
uses: actions/setup-node@v2
39+
with:
40+
node-version: 12.x
41+
42+
- name: Cache Node Modules
43+
uses: actions/cache@v2
44+
with:
45+
path: "/node_modules"
46+
key: node-${{ hashFiles('yarn.lock') }}
47+
48+
- name: Create Deployment
49+
id: deployment
50+
run: ./ci/scripts/github_deployment.sh create
51+
env:
52+
GITHUB_TOKEN: ${{ github.token }}
53+
DEPLOY_ENVIRONMENT: codercom-preview-docs
54+
55+
- name: Deploy Preview to Vercel
56+
id: preview
57+
run: ./ci/scripts/deploy_vercel.sh
58+
env:
59+
VERCEL_ORG_ID: team_tGkWfhEGGelkkqUUm9nXq17r
60+
VERCEL_PROJECT_ID: QmZRucMRh3GFk1817ZgXjRVuw5fhTspHPHKct3JNQDEPGd
61+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
62+
CODE_SERVER_DOCS_MAIN_BRANCH: ${{ github.event.pull_request.head.sha }}
63+
64+
- name: Update Deployment
65+
# If we don't specify always, it won't run this check if failed.
66+
# This means the deployment would be stuck pending.
67+
if: always()
68+
run: ./ci/scripts/github_deployment.sh update
69+
env:
70+
GITHUB_DEPLOYMENT: ${{ steps.deployment.outputs.id }}
71+
GITHUB_TOKEN: ${{ github.token }}
72+
DEPLOY_STATUS: ${{ steps.preview.outcome }}
73+
DEPLOY_URL: ${{ steps.preview.outputs.url }}
74+
75+
- name: Comment Credentials
76+
uses: marocchino/sticky-pull-request-comment@v2
77+
if: always()
78+
with:
79+
header: codercom-preview-docs
80+
message: |
81+
✨ Coder.com for PR #${{ github.event.number }} deployed! It will be updated on every commit.
82+
83+
* _Host_: ${{ steps.preview.outputs.url }}/docs/code-server
84+
* _Last deploy status_: ${{ steps.preview.outcome }}
85+
* _Commit_: ${{ github.event.pull_request.head.sha }}
86+
* _Workflow status_: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)