-
Notifications
You must be signed in to change notification settings - Fork 23
67 lines (59 loc) · 1.85 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Pull Request
on:
pull_request:
branches:
- main
jobs:
preview-website:
runs-on: ubuntu-latest
environment:
name: preview
url: https://site-interslavic-pr-${{ github.event.pull_request.number }}.surge.sh
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
DEPLOYMENT_URL: https://site-interslavic-pr-${{ github.event.pull_request.number }}.surge.sh
steps:
- name: Start deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: preview
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2 # To retrieve the preceding commit.
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
separator: '\n'
- name: Write changed files to log
run: |
echo "${{ steps.changed-files.outputs.all_changed_files }}" > git-changes.log
cat git-changes.log
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: NPM install
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Build a preview
run: npm run build
- name: Deploy to Surge
run: npx surge ./build ${{ env.DEPLOYMENT_URL }}
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: Update deployment status
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}